November 3, 2007 at 5:07 am
Hi,
I am having trouble getting my head around a problem. I am trying to retrieve info from a single table.
To explain and simplify the the problem the table would hold basic user info with the following columns.
user ID, 1st username, managersID.
I would like to pull info out that lists a users id, name, mangers id and the mangers name.
The managers name comes from putting the managers ID into the user id column and then selecting the name.
I was thinking about embedded select statements or using a cursor but not sure if this would work.
Any help would be appreciated.
November 3, 2007 at 5:26 am
Here it is....
SELECTU.UserID, U.UserName, U.ManagerID, M.UserName AS ManagerName
FROMdbo.Users E
LEFT JOIN dbo.Users M ON E.ManagerID = M.UserID
--Ramesh
November 8, 2007 at 10:38 pm
Thanks Ramesh,
As you can see in the orginal message I was looking in the wrong direction.
I have been able to apply in theory multiple joins to get the data I was after.
November 8, 2007 at 10:51 pm
SO... what does all of that mean? Did you use Ramesh's solution or not? If not, would you post your solution, please?
--Jeff Moden
Change is inevitable... Change for the better is not.
November 12, 2007 at 4:45 pm
Yes. I could get the data I was after by using a join
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy