Hi, having a problem with my mysql select.
I have 2 tables:
user_info: user_id, f_name, l_name.
events: user_id, affected_user_id, action. (user_id "pointing to" user_info.user_id)
I want to gather user_id, f_name, l_name, action TOGETEHR WITH user_id (affected_id) f_name, l_name in one selection.
meaning.. in one row the output should be like:
(id) 22, (fn) Steve, (ln) Smith, (act) Paints, (affected_id) 83, (fn) John, (ln) Johnson.
Anyone?
5 replies to this topic
#1
Posted 29 April 2011 - 06:22 PM
|
|
|
#2
Posted 29 April 2011 - 08:37 PM
you need to use a join.
#3
Posted 30 April 2011 - 12:42 AM
Yes, I've tried many different approaches but I cannot figure it out.
The problem is that I don't understand how to get two different persons user_id, f_name and l_name from the same table into the same row on out put.
The problem is that I don't understand how to get two different persons user_id, f_name and l_name from the same table into the same row on out put.
#4
Posted 30 April 2011 - 05:14 AM
You'll need to have more than one join, one for each person.
#5
Posted 30 April 2011 - 05:27 AM
Could someone please write those line of sql needed for this operation? I do not manage it on my own.
#6
Posted 30 April 2011 - 08:58 AM
Solved it with nested queries.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









