Subject | Re: [firebird-support] group by date |
---|---|
Author | Mark Rotteveel |
Post date | 2014-12-12T14:20:38Z |
On Fri, 12 Dec 2014 15:15:40 +0100, "'checkmail' check_mail@...
[firebird-support]" <firebird-support@yahoogroups.com> wrote:
GROUP BY CAST(m.messzeit AS DATE)
or less efficient:
GROUP BY EXTRACT(YEAR from m.messzeit), (EXTRACT(month FROM m.messzeit),
EXTRACT(day from m.messzeit)
or if you want to group by month in year:
GROUP BY EXTRACT(YEAR from m.messzeit), (EXTRACT(month FROM m.messzeit)
Mark
[firebird-support]" <firebird-support@yahoogroups.com> wrote:
> Hello @ll,daily
>
> I would like to group my records by day or month. The date is saved as
> timestamp. If I do the following,
>
> SELECT EXTRACT(day FROM m.messzeit), COUNT(*) as CountMessages
> FROM te_messzeiten m
> GROUP BY EXTRACT(day FROM m.messzeit)
>
> I get all days (1 to 31), but I need group by 1.1.2014, 2.1.2014.. -
> bzw. 1 2014, 2 2014 - monthlygroup by day:
>
> How can I realize this?
GROUP BY CAST(m.messzeit AS DATE)
or less efficient:
GROUP BY EXTRACT(YEAR from m.messzeit), (EXTRACT(month FROM m.messzeit),
EXTRACT(day from m.messzeit)
or if you want to group by month in year:
GROUP BY EXTRACT(YEAR from m.messzeit), (EXTRACT(month FROM m.messzeit)
Mark