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)
 getting result set

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-18 : 21:26:22
Dhili Sriramulu writes "Table: Departments

Dept_id    Dept_name    Parent_Dept_Id
1 cloths 0
2 sports 0
3 toys 0
4 For him 1
5 For her 1
6 cricket 2
7 tenis 2
8 below 10 3
9 below 15 3


note : If Parent_Dept_Id is 0 means that department is parent.

I want to get the result set like... first parent department under that respective child departments again parent department under that respective child departments.........

Expecting result set.......

Dept_id    Dept_name    Parent_Dept_Id
1 cloths 0
4 For him 1
5 For her 1
2 sports 0
6 cricket 2
7 tenis 2
3 toys 0
8 below 10 3
9 below 15 3


sql server 7.0
windows nt 4.0"
   

- Advertisement -