Is it possible to do an Outer self join? Got a Content table, which has
fields ID, ContentID and Title. A piece of content can either be
top-level, in which case ContentID = 0, or it can be second-level, in which
case ContentID = the ID of it's parent Content. Wanting to get the list of
all top-level and second-level content items, grouped hierarchically. I'm
assuming this isn't impossible to do simply, but this code here isn't doing
what I want:
SELECT C.*, C2.ID AS SubmenuID, C2.Title AS SubmenuTitle
FROM Content C
LEFT OUTER JOIN Content C2
ON C2.ContentID = C.ID
WHERE C.ContentID = 0
ORDER BY C.ContentID
<cfoutput query="getContentMenuItems" group="ContentID">
#getContentMenuItems.Title#
<cfoutput>
#getContentMenuItems.Title#
</cfoutput>
</cfoutput>
Instead of:
Colours
Red
Green
Blue
Cities
Barcelona
Paris
London
Names
John
Jane
I get:
Colours
Red
Green
Blue
Barcelona
Paris
London
John
Jane
Duncan Cumming
IT Manager
http://www.alienationdesign.co.uk
mailto:[EMAIL PROTECTED]
Tel: 0141 575 9700
Fax: 0141 575 9600
Creative solutions in a technical world
----------------------------------------------------------------------
Get your domain names online from:
http://www.alienationdomains.co.uk
Reseller options available!
----------------------------------------------------------------------
----------------------------------------------------------------------
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]