[thelist] Monthly Counts in order

Michele Foster (WizarDev) michele at wizardev.ca
Tue May 10 07:30:47 CDT 2005


----- Original Message ----- 
From: "Michele Foster (WizarDev)" <michele at wizardev.ca>


> Another SQL question ...
>
> SELECT Month(RefDate) as MyMonth, Year(RefDate) as MyYear, COUNT
> (Month(RefDate)) AS MonthlyTotal
>   FROM ext_Refs
>   GROUP BY Month(RefDate), Year(RefDate)
>
> This is giving me the correct totals for the month ..
>
> October 2004 = 32
> January 2005 = 158
> May 2004 = 44
>

I got this figured out this morning ... I guess a few hours sleep does help
sometimes.  :)

In case anyone is wondering, my Order By after my Group By is ..
ORDER BY Year(RefDate) DESC, Month(RefDate) DESC

Mich



More information about the thelist mailing list