Getting all childs recursively in query [RESOLVED]
i have this 'manager like' table : ManagerID + Name + ParentID which it can have many descendants inside ex:
1 + A + 0
2 + B + 1
3 + C + 2
4 + D + 2
5 + E + 1
6 + F + 0
7 + G + 6
...
so when i want to get all childs for parent 1 it will return
B - C - D then
E without any childs
any insight?
PS: i'm using SQL SERVER 2005
thanks,
Re: Getting all childs recursively in query
it can be done using Common Table Expression
Read BOL for more information
PS: this only valid for SQL 2005 and above
thanks
Re: Getting all childs recursively in query [RESOLVED]
This would be relevant, and for SQL Server 2000.