January 14, 2005 at 10:47 am
Hello,
my table contains 2 columns .
EmpID varchar(10),ReportingToID varchar(10)
how to write a query that returns all the employees under a ReportingToID ...?
the key here is i want all the employees that are under a ReportingToID tree.
i don't know the exact number of levels under a ReportingToID
empID ManagerID
abc ""
def abc
ghi abc
jkl ghi
klk jkl
mmm jkl
Thank You
Sai
January 18, 2005 at 8:35 am
SInce I had to do this in SQL 7 the best way I found was to use a and insert from a starting point then join the temp table to the source table to insert additional rows until I could not find further to find.
January 18, 2005 at 8:54 am
The BOL article 'Expanding Hierarchies' shows a solution to a similar scenario.
/Kenneth
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply