Copy link to clipboard
Copied
I have it kind of working but i need to do a second group for the months.
2010
June News Item1
June News Item2
June News Item3
April News Item4
I need to group so
2010
June
News Item1
News Item2
News Item3
April
News Item4
This is what I have so far
<cfquery name="qGetResults" datasource="mysource"> SELECT * FROM results </cfquery>
<cfdump var="#qGetResults#">
<cfoutput query="qGetResults" group="year">
#year# <br />
<cfoutput>#MonthAsString(Month(result_date))# #title#<br /></cfoutput>
</cfoutput>
thanks.
Copy link to clipboard
Copied
First, put an order by clause in your query. Otherwise the group attribute of cfoutput won't work properly.
Next, you can use the group attribute more than once on the same query. It goes something like this.
<cfoutput query = "abc" group = "field1">
#field1#
<cfoutput group = "field2">
#field2#
<cfoutput>
#ungrouped data#
closing tags.