Hi all,

I have a "limited tree" kind of deal going with a table of categories -
the structure is like so:

pkCategories    category_name   fkParentCategory                

To save it from turning into absolute hell, there can only be three
categories deep - so a category can have a subcategory which can have
subcategories, but that's as far as it goes.

I want to use Nate Weiss's custom tag "three selects related". To use it
I need to create a query object with the following structure:

grandparentID   grandparentname parentID        parentname      childID
childname

I have no idea how to write such a beast. I started out with:

SELECT A.pkCategories, A.category_name, A.fkParentCategory, 
                        ( SELECT B.pkCategories, B.category_name,
B.fkParentCategory
                        FROM Categories B                       
                        WHERE B.pkCategories = A.fkParentCategory
                        ) 
FROM Categories A

But I'm not really sure what I'm doing or where I'm going :)

If it's not possible with SQL, I could use CF's query functions to
create what I need. That requires a whole rethink though.

Any help greatly appreciated!

Kay.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to