February 28, 2012 at 2:50 pm
I have One table which have records ID,Name,supervisorID
, ID is the primary key and everyone has ID. But I need to get from this table Id and names corresponding to supervisor ID. I tried correlated sub query but couldn’t get it. Any feedback?
February 28, 2012 at 2:54 pm
Willing to help but I need a better description and question. Remember we can't see your databases.
February 28, 2012 at 3:11 pm
Really could use more info, but you could do something like this:
Select Supervisor.Name as SupName, Employee.Name as EmpName
From TableA as Supervisor
Inner Join TableA as Employee
on Superviser.ID = Employee.SupervisorID
If you want to ensure the "Supervisor" table only references a specific role/id/person/etc, then you will need a where clause for that piece, then it will only return those that report to that Supervisor.
February 28, 2012 at 3:24 pm
take a look at this post/thread....maybe helpful
http://www.sqlservercentral.com/Forums/FindPost1071067.aspx
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply