You will need to add ORDER BY
clauses in your query for this to work, but you can nest cfoutput
tags that use the group
attribute.
<cfoutput query="someItems" group="someColumnName">
... doing some stuff here ..
<cfoutput group="someOtherColumnName> doing stuff with some sub items </cfoutput>
</cfoutput>
This assumes that in your query you have something that looks like:
ORDER BY someColumnName, someOtherColumnName
Keep in mind that the group
attribute of cfquery
is not the same as the GROUP BY
clause in a SQL statement. You can use the group
attribute of cfoutput
for ANY column that is in the ORDER BY
clause in your query.