Oh oops. You need another <CFOUTPUT group = LnkCategoryID> inside the first <CFOUTPUT> that should do it. I don't have any code in front of me but that should work.
J. John Wilker Web Applications Consultant, and Author Macromedia Certified ColdFusion Developer President/Founder, Inland Empire CFUG. www.red-omega.com "more people are killed by donkeys than by airplane crashes each year" -----Original Message----- From: Tangorre, Michael T. [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 10:05 PM To: CF-Talk Subject: RE: SQL & CF Question John. I tried what u suggested, but it just outputs the main Categories. SELECT CategoryID, LnkCategoryID, CategoryTitle FROM categories WHERE LnkCategoryID = 0 GROUP BY CategoryID, LnkCategoryID, CategoryTitle <cfoutput query="name" group="CategoryID"> .. Am I issing anything? Mike -----Original Message----- From: John Wilker [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 12:36 AM To: CF-Talk Subject: RE: SQL & CF Question Try grouping SELECT blah from blah GROUP BY CategoryID, LnkCategoryID, etc.. You'll need to put every column you call in the group by as well but the first two should be those. Then CFOUTPUT that query group= CategoryID HTH J. John Wilker Web Applications Consultant, and Author Macromedia Certified ColdFusion Developer President/Founder, Inland Empire CFUG. www.red-omega.com "more people are killed by donkeys than by airplane crashes each year" -----Original Message----- From: Tangorre, Michael T. [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 9:34 PM To: CF-Talk Subject: SQL & CF Question Hi Everyone. Can someone help me out with the following problem. I have a table in my SQL DB called categories. In it there are 3 fields: CategoryID, LnkCategoryID, CategoryTitle What I am trying to do is the following: When LnkCategoryID = 0 that means that that record is a Main Category. So in my table there are 3 main categories right now: CategoryID = 1 LnkCategoryID = 0 CategoryTitle = Hardware CategoryID = 2 LnkCategoryID = 0 CategoryTitle = Software CategoryID = 3 LnkCategoryID = 0 CategoryTitle = Software Each Main Category can have subcategories and you can probably see that the LnkCategoryID becomes the CategoryID from the main categories. CategoryID = 4 LnkCategoryID = 1 CategoryTitle = Hard Drives CategoryID = 5 LnkCategoryID = 1 CategoryTitle = CD Rom Drives CategoryID = 6 LnkCategoryID = 1 CategoryTitle = Floppy Drives etc...etc.. Well I am trying to output the Main Category with the lnked categories below them such as: Hardware -Hard Drives -CD Rom Drives -Floppy Drives Software -Web Editors -Graphics -Operating Systems etc.. How can I write the SQL Statement for this and use it with cfloop or cfquery to get my desired results. My apologies for the long post, I tried for awhile to get it on my own, I thought I would ask now. Thanks to anyone who can help. I am a novie SQL user/writer. Michael T. Tangorre ====================== Alfred University Webteam Manager AIM: CrazyFlash4 Phone: 607-426-9277 ====================== ______________________________________________________________________ Why Share? Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists