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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Urgent want a Simple Query

Author  Topic 

bommi_k
Starting Member

2 Posts

Posted - 2003-03-04 : 06:23:24
I want to write a simple query, where i have a table Emp it contains columns like empid,supervisorid etc..,

One employee can be a supervisor, and that employee can be under some other employee etc..,

For eg:

Empid Supervisorid

Raj -
Kumar Smith
Smith David
Bob Raj
David Bob

I will pass a Employeeid, i want all the Employees in that particular hierarchy.i.e., I will pass Raj, i want all the Employees i.e., Raj-Bob-David-Smith-Kumar

Please help me

Thanks & Regards.,
B.Naveen Kumar




samrat
Yak Posting Veteran

94 Posts

Posted - 2003-03-04 : 07:05:54
http://www.sqlteam.com/item.asp?ItemID=8866

Check this link, has a very nicely written article on More Trees & Hierarchies in SQL.

HTH

Samrat
Go to Top of Page
   

- Advertisement -