example....
<query...> SELECT state, city, firstName, lastName FROM myTable ORDER BY state, city, firstName, lastName ------ <cfoutput query="myQuery" group="state"> #state#<br> <cfoutput group="city"> ---#city#<br> <cfoutput group="firstName"> ------#firstName#<br> <cfoutput> ---------#lastName#<br> </cfoutput> </cfoutput> </cfoutput> </cfoutput> ---------------------------- this will yield the following results: State1 ---City1 ------Adam ---------whatever1 ---------whatever2 ---------whatever3 ------Bob ---------whatever1 ---------whatever2 ---------whatever3 ---City2 ------Adam ---------whatever1 ---------whatever2 ---------whatever3 ------Bob ---------whatever1 ---------whatever2 ---------whatever3 State2 ---City1 ------Adam ---------whatever1 ---------whatever2 ---------whatever3 ------Bob ---------whatever1 ---------whatever2 ---------whatever3 ---City2 ------Adam ---------whatever1 ---------whatever2 ---------whatever3 ------Bob ---------whatever1 ---------whatever2 ---------whatever3 -----Original Message----- From: Paul Ihrig [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 4:34 PM To: CF-Talk Subject: RE: output cf to html yeh... i think i understand that Bryan but when i am doing a count on the records then dividing them into say 3 generating separate columns of data say 3 that's where i get all messed up i can easily out put in to 3 columns from the top down then right & down but if i want that out put to be grouped & possibly sub grouped say on studio name then say title that's when it gets so funky that i just resort to dumb 3 column looped queries that i include 20+ times in a master page! argh! should be easy to figure out, but i cant thx -paul -----Original Message----- From: Bryan Love [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 6:40 PM To: CF-Talk Subject: RE: output cf to html simple lesson in query grouping... When you specify a group attribute like so... <cfoutput query="myQuery" group="firstName"> do whatever <cfoutput> do inner stuff </cfoutput> </cfoutput> it will loop over the results and will "do whatever" every time it finds a "firstName" that is different than the previous result. "do inner stuff" will process all the rows that have the same "firstName" as the previous row. Example: row firstName lastName ------------------------ 1. Adam Ant 2. Adam Apple 3. Anna Conda for the code above, "do whatever" will happen for rows 1 and 3. "do inner stuff" will happen for row 2. It is crucial that you ORDER BY whatever column you want to group by in your SELECT query. +-----------------------------------------------+ Bryan Love Macromedia Certified Professional Internet Application Developer Database Analyst Telecommunication Systems [EMAIL PROTECTED] +-----------------------------------------------+ "...'If there must be trouble, let it be in my day, that my child may have peace'..." - Thomas Paine, The American Crisis -----Original Message----- From: Paul Ihrig [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 3:18 PM To: CF-Talk Subject: RE: output cf to html thanks guys... i will try it a few differnt way that you suggested. Now if i could only learn how to loop over my quries with a group with QaQ?? then i think i wouldnt even need to do this right now i have like 20 incldes a hiting the same data source many, many times just to get the output i want very convoluted & amature... i know.. wish i knew more. ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm 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