GROUP BY MONTH?
Paul Gaspar
devlist at revolversoft.com
Sun Dec 28 03:20:47 CST 2008
Thank you, Thorsten! This works like charme.
Paulk
Am 28.12.2008 um 09:57 schrieb Thorsten Hohage:
> Hi Paul,
>
> On 2008-12-28, at 05:42, Paul Gaspar wrote:
>
>> is there any way to GROUP BY a datepart like MONTH or YEAR?
>
> Yes, and you don't need to create functions / calculated columns for
> all group by values you want to use. After teached by Ivan often
> enough I'm now the happy to answer
>
> Use this query
>
> SELECT YEAR(mydate), MONTH(mydate), mynumber
> FROM table
>
> as a inner select statement and then do
>
>
> SELECT Y1, M1, sum(mynumber) from
> (SELECT YEAR(mydate) Y1, MONTH(mydate) M1, mynumber
> FROM table)
> GROUP BY Y1, M1
>
> and you're done.
More information about the Valentina
mailing list