yes, there is, it's called groupingrun one query like this: <CFQUERY NAME="monthly"> select year(expenseDate) as theyear , month(expenseDate) as themonth , sum(cost) as monthlycost from expenses group by year(expenseDate) , month(expenseDate) order by 1,2 </CFQUERY>
now set up a two-level CFOUTPUT to produce your totals <CFOUTPUT QUERY="monthly" GROUP="theyear"> <h1>#theyear#</h1> <CFSET yeartotal = 0 > <CFOUTPUT> <p>month: #themonth# total: #monthlycost#</p> <CFSET yeartotal = yeartotal + monthlycost > </CFOUTPUT> <h3>total for #theyear#: #yeartotal#</h3> </CFOUTPUT>
rudyhttp://r937.com/