You can use multiple nested cfouput group="" commands that will allow you to group by id and then group by month.
-- William E. Seiter Have you ever read a book that changed your life? Go to: www.winninginthemargins.com Enter passkey: goldengrove Web Developer / ColdFusion Programmer http://William.Seiter.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, February 25, 2008 11:24 AM To: CF-Newbie Subject: nested query output Hi, I'm sure my problem isn't a hard one, but I'm somewhat new to CF and any help would be certainly useful. I'm creating a dynamic six-month calendar for a course schedule. It displays the id, name, day range, and location of each course, which pulls from the this query: SELECT QEBrazilCourses.id, QEBrazilCourses.myName, QEBrazilCourses.Hours, QEBrazilCourses.Days, QEBrazilCourses.Weblink, QEBrazilDates.id, QEBrazilDates.myDate, QEBrazilDates.Location FROM QEBrazilCourses, QEBrazilDates WHERE (QEBrazilCourses.id = QEBrazilDates.id) AND (month(QEBrazildates.myDate) BETWEEN month(now()) AND month(now()) + 5) ORDER BY #sortBy#, myDate ASC It outputs as follows: <cfoutput query="qeCoursesA" group="id"> <p><a href = "#qeCoursesA.Weblink#">#qeCoursesA.id# - #qeCoursesA.myName#</a></p> <!---Outputs course id, name, and links them to the appropriate file---> <table> <tr> <td valign="top" bgcolor="eeeeee"><!---Outputs the day range and location of each course---> <p><cfoutput>#DateFormat(qeCoursesA.myDate, 'dd')#<cfif #dateformat(dateadd("d", qeCoursesA.Days-1, qeCoursesA.myDate), "dd")# EQ #dateformat(qeCoursesA.myDate, "dd")#><cfelse>-#dateformat(dateadd("d", qeCoursesA.Days-1, qeCoursesA.myDate), "dd")#</cfif> - #qeCoursesA.Location#<br></cfoutput></p> </td> </tr> </table> </cfoutput> So far, my day range and location is correctly displayed under each course. This is how it looks right now: February March April Course ID/Course Name 15-20 Houston 25-29 Houston 1-5 New Orleans 10-12 San Diego 10-15 Washington, D.C. 6-9 Orlando, FL However, I need to go one more step beyond that and group those dates by month, but I'm not sure how to do it. This is how it should look: February March April Course ID/Course Name 15-20 Houston 25-29 Houston 1-5 New Orleans 10-12 San Diego 10-15 Washington, D.C. 6-9 Orlando, FL I tried doing a separate query until I found out you can't nest cfoutput tags. Then, I tried doing a cfloop inside a cfoutput, but it didn't seem to work correctly. Can someone give me a tip on solving this? Thanks very much, Lan Mai ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3348 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
