Is the problem with your query or your output? Do you get the right results
when you run the query in some sort of query analyzer? If not, my first
question would be about the nested year(month( function. Do you need to do
it that way? Can't you just use year(column)?

If it's an output issue, it's probably because of the way you're grouping
your cfoutput & ordering your query. You're grouping by the month, but you
don't then have an inner cfoutput to get all the years. If you want to
display by month, you should also order your query by month, then by year.
Right now, I'm guessing that your query is ordering by year, then by month
(based on the order of your select and group by clauses.)


----- Original Message ----- 
From: "Ihrig Paul E Cont 88 ABW/EM" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, September 17, 2003 9:00 AM
Subject: GROUP BY year, month loop


> ok i am having a slight brain fart.
> have left my reference books at home
>
> i want to loop through year, grouping by month & displaying sum total.
>
> right now i have it grouping by month & displaying sum total, but it lumps
the year together..
> should be simple, and i have search archives..
> thanks
> -paul
>
> <cfquery name="rsDisMonth" datasource="recycle">
> SELECT Year(Month(Offload_Date)) as yearEnterd, Month(Offload_Date) as
monthEnterd,
> SUM(Offload_Gallons) AS SumGal
> FROM tblOffload
> GROUP BY Year(Month(Offload_Date)), Month(Offload_Date)
> </cfquery>
>
>   <cfoutput query="rsDisMonth" group="monthEnterd">
>     <tr align="right" valign="top">
>       <td>#YearEnterd#</td>
>       <td>#monthEnterd#</td>
>       <td>#LSNumberFormat(SumGal,',99999999999999.99')#</td>
>       <td>&nbsp;</td>
>       <td>&nbsp;</td>
>       <td>&nbsp;</td>
>     </tr>
>   </cfoutput>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to