Seems to mee like you're building a tree... You may want to consider looking at the nested tree model...
I warn you though, it's not for the faint of heart... http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci801943,00.html -----Original Message----- From: Jochem van Dieten [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 1:04 PM To: CF-Talk Subject: Re: OT: SQL Booger of a query Paul Giesenhagen wrote: > I have the following table > > Name Grandparent Parent Child > ======================================== > Fishing 100 0 0 > Reels 100 1 0 > Baitcast 100 1 1 > Spinning 100 1 2 > Hunting 200 0 0 > Archery 200 1 0 > Bows 200 1 1 > > I am going nuts trying to write a query that will give the final > result of: > > Fishing/Reels/Baitcast > Fishing/Reels/Spinning > Hunting/Archery/Bows > ect... > > Is this possible to do in a query? Just rewrite your database structure to use an nested set model instead of an adjacency list model. http://www.intelligententerprise.com/001020/celko.shtml Jochem ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

