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.
Author |
Topic |
ann
Posting Yak Master
220 Posts |
Posted - 2010-08-25 : 15:10:17
|
Need to get the Manager & Report manager name from a users lookup table:Table Project:ProjectID, ProjName, Manager, ReportingManager1, ProjectA, 1, 22, ProjectB, 3, nullTable Users:UserID, FirstName, LastName1, Joe, Smith2, Mickey, Mouse3, Daffy, DuckResults:ProjectA, Joe Smith, Mickey MouseProjectB, Daffy Duck, NULLI can get the project Manager name ok using an innerjoin, but I can't seem to figure out how to get the ReportingManager.Can anyone help or point me in the right direction?Thanks |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-25 : 15:55:03
|
Use LEFT JOIN instead of INNER JOIN to get your data.SELECT *FROM Project AS pLEFT JOIN Users AS m ON m.UserID = p.ManagerLEFT JOIN Users AS rm ON rm.UserID = p.ReportingManager N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|
|