BTW Joe Clecko had an entire book on trees coming soon "TREES & HIERARCHIES IN SQL (Morgan-Kaufmann), 2003"
http://www.celko.com/books.htm WG -----Original Message----- From: Michael T. Tangorre [mailto:[EMAIL PROTECTED] Sent: 09 July 2003 14:48 To: CF-Talk Subject: Re: Creating a list with infinite groupings and indents First off... the way you have it setup now will only allow for two levels.. level 1 and level 2. To get the ability you are after (tree type strucutre), you need to get into nested sets. Joe Celko has done some awesome work in this area and the links below may help you out. It is a bit tricky at first, but once you get it, it is very powerful. The sql statements for adding/removing/updating "children" or "parents" is already written in the links below and you can adjust them slightly to work for your situation. I would definitely start there. http://www.dbmsmag.com/9603d06.html http://www.mvps.org/access/queries/qry0023.htm HTH, Mike ----- Original Message ----- From: "John Sprenkle" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Wednesday, July 09, 2003 9:19 AM Subject: Creating a list with infinite groupings and indents > Say I have a table with the following records: > > rec id description parent id > 1 Test Record 1 0 > 2 Test Record 2 1 > 3 Test Record 3 1 > 4 Test Record 4 3 > 5 Test Record 5 3 > 6 Test Record 6 4 > 7 Test Record 7 4 > 8 Test Record 8 3 > > The parent id field relates a record to its parent. I want to display the > records in a list so that children records are listed indented under their > parent. There can be an infinite number of nested parents and children, so there > could be many indents in the list. The output in this example should look like > this: > > Test Record 1 > Test Record 2 > Test Record 3 > Test Record 4 > Test Record 6 > Test Record 7 > Test Record 5 > Test Record 8 > > Could somebody give me direction on how to program this? Sample code? > > Thank you. > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4