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)
 by query instead recursive function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-07 : 09:26:06
maoz writes "Hi,
my Table:

ID     ParentID        IsReal
-- -------- -------
1       1       1
2       1       0
3       2       0
4       2       1
5       4       0
6       1       0
7       5       0


I want to SELECT all childs in tree from the point i will
indicate in where and down.

So for ID 1 i'll get

2,3,4,5,6,7 all of the child and grandchild and so on ..

for ID 4 i'll get
5,7

And for ID 2 i'll
all of them as well
because the flag IsReal set to 0
and his parent is ID '1' and he owns all of them
Thank's
Maoz"
   

- Advertisement -