You could use hierarchal SQL to get it all at once from the single table too:

http://www.oreilly.com/catalog/sqlpr/chapter/ch01.pdf

On 1/6/07, Snake <[EMAIL PROTECTED]> wrote:
> You can do that with a single table.
>
> [categories]
> categoryID int primary key
> CategoryName varchar
> parentCat  int default (0)
>
> If parentCat is 0, then it is a parent Category, if it has a value, then it
> is a subCategory of the specified parent.
>
> Then your query would be for example
>
> <cfquery name="categories">
> SELECT categoryID, CategoryName, parentCat
> FROM categories
> Order by parentCat
> </cfquery>
>
> Then to display it you just do a nested loop to get all subcategories for
> each parent category.
> This will only work if you have nested 1 level.
> Otherwise your better off to write a UDF or custom tag to output the list
> and then you can infinitely nest by calling itself.

-- 
CFAJAX docs and other useful articles:
http://www.bifrost.com.au/blog/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265911
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to