| Author |
Topic  |
|
|
rickystyx
Starting Member
4 Posts |
Posted - 03/15/2013 : 12:55:22
|
Any help will be appreciated.
Two tables: "Events", "Users" "Events" columns are: Timestamp, UserID_A, UserID_B "Users" columns are: UserID, UserName
I need to SELECT UserName_A and UserName_B from "Users" based on the UserID's in "Events". One column is easy enough, but I can't figure out how to join user information for multiple columns.
Thanks in advance!
|
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47173 Posts |
Posted - 03/15/2013 : 12:57:47
|
the hint is to link it twice each time based on different column
Make a try and post in case you face any issue
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
rickystyx
Starting Member
4 Posts |
Posted - 03/15/2013 : 13:04:31
|
Looks like I figured it out. Thanks for the direction... it's much appreciated. Here's my query, with a few more details :)...
select s.sessionid as 'SessionID', s.evtime as 'TransferTime', u1.displayname as 'TransferringAgent', u2.displayname as 'ReceivingAgent'
from dbo.sessionevents s inner join dbo.users u1 on s.evid = u1.id inner join dbo.users u2 on s.evparam = u2.id where ...
Thanks again, visakh16 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47173 Posts |
Posted - 03/15/2013 : 13:10:23
|
cool... welcome
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|