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)
 Complex SQL query

Author  Topic 

LovePuppy
Starting Member

1 Post

Posted - 2003-02-28 : 05:28:07
I have a table containing an RID and RRID, the RID is is a ReactionID
the RRID is the RID of the parent-RID or parent RRID. (sounds like someone is making a sort of forum ).
Now I want to make a query that looks up first of all the RID's but immediatly after that all their child-RID's and their child-RID's (and so on and so on).
So it has to come sorted for publication immediatly.

P.s. The highest Parent-RID is linked to an AID (which is a topic-id).

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-02-28 : 07:12:08
Read Rob's article on More Trees & Hierarchies in SQL.

IMHO, the adjacency model is not well suited to model a hierarchy with unknown depth. I've had much success with Joe Celko's Net-Nested Set model.


Jay White
{0}
Go to Top of Page
   

- Advertisement -