Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Two Tables

Author  Topic 

vidhya
Posting Yak Master

108 Posts

Posted - 2008-10-01 : 13:05:38
Hi Friends,

I had two tables User and Request Table.

User Table has UserId and UserName
Request Table as UserId and ReporterId

I need to get Two UserName ,One for the UserId and other for the ReporterId
How can I get id ?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-01 : 13:08:53
use User table twice

SELECT u1.UserName AS User,u2.UserName AS Reporter
FROM Request r
JOIN User u1
ON u1.UserId=r.UserId
JOIN User u2
ON u2.UserId=r.ReporterId
Go to Top of Page
   

- Advertisement -