If your group exists only to remove duplicates from the results, I would suggest using your query to shorten them, then you can cfloop (select the selection and reduce the list of returned columns).
If you use your group to βgroupβ your results, you can run the counter in your loop and the cfif statement in your first loop to omit later results.
You can fake a group by parameter in your cfloop by matching the value from the previous line if you need cfbreak
<cfloop query="queryname"> <cfif queryname.column[currentrow-1] neq queryname.column[currentrow]> #queryname.column# </cfif> </cfloop>
Random note: you can click on any / all levels of grouped cfoutput
<cfset tmp = querynew('id,dd')> <cfloop from="1" to="20" index="i"> <cfset queryaddrow(tmp,1)> <cfset querysetcell(tmp,'id',rand(),i)> <cfset querysetcell(tmp,'dd',(i mod 4),i)> </cfloop> <cfquery dbtype="query" name="tmp">select * from tmp order by dd</cfquery> <cfoutput query="tmp" group="dd" maxrows="2">#dd#<br <ul> <cfoutput maxrows="2" group="id"><li>#id#</li></cfoutput> </ul> </cfoutput>
Patrick spenceley
source share