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)
 Recursive Join

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-12-26 : 10:39:19
Cliff writes "I'm a little confused with the recursive join example. Does it really drill down all the children?

Take this table

DocID ParentID Name
1 0 A
2 1 B
3 0 C
4 1 D
5 4 E
6 5 F
7 2 G

I want to be able to say "Get me all the children of DocID 1"

I expect to get "BDGEF"

An even greater challenge, I want to do it the other way, "Get me a crumb trail from a given DocID back to the parent.

So for "7" I would expect to get "GB" and "6" would give "FEDA""

Peter Dutch
Posting Yak Master

127 Posts

Posted - 2002-12-27 : 07:05:39
Search Books Online for 'Expanding Hierarchies'

They have an example on how to do this

Go to Top of Page
   

- Advertisement -