>Any ideas?
>
>Hello @ll,
>
>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.. – daily 
>bzw. 1 2014, 2 2014 – monthly
>
>How can I realize this?

A few minutes after you asked this question, Mark gave you a very good answer:

group by day:

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

------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-dig...@yahoogroups.com 
    firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

  • ... 'checkmail' check_m...@satron.de [firebird-support]
    • ... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
    • ... Olaf Kluge check_m...@satron.de [firebird-support]
      • ... Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
      • ... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
        • ... 'checkmail' check_m...@satron.de [firebird-support]

Reply via email to