Not sure about SQL, but you could do it with SQL and a recursive CF query of queries function.
However, personally I'm not sure I'd bother trying to do this with SQL, (unless there's a specific reason you need to), because simple XML can store that tree structure much more nicely. On 11/14/06, Duane <[EMAIL PROTECTED]> wrote: > Is it possible to create a recursive query in SQLServer? > > I have a table that contains a parent/child record relationship and I want > to build a tree without client side processing. > > ID Parent > 1 Null > 2 1 > 3 Null > 4 2 > 5 1 > 6 Null > 7 2 > 8 6 > > Needs to be sorted as > -1 > - 2 > - 4 > - 7 > - 5 > -3 > -6 > - 8 > > > TIA, > Duane > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2619 Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6
