Terry Hogan wrote:
> 
> CategoryID      ParentID    Level     CategoryName
> ----------      --------    -----     ------------
> 1               0           1         Animals
> 2               1           2         Dogs
> 3               2           3         GermanShepard
> 4               1           2         Cats
> 5               4           3         Siamese
> 
> 
> I'd like to put together a query where I could output something like:
> Animals
> Animals/Dogs
> Animals/Dogs/GermanShepard
> Animals/Cats
> Animals/Cats/Siamese
> 
> I only plan on going 3 levels deep.

SELECT
        a.categoryname,
        b.categoryname,
        c.categoryname
FROM
        tblCategory a LEFT JOIN
                tblCategory b ON a.CategoryID = b.ParentID LEFT JOIN
                        tblCategory c ON b.CategoryID = c.ParentID

Then use the group attribute of cfoutput for displaying.

Jochem


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
                                

Reply via email to