Subject | Re: [firebird-support] Group by month based on a timestamp? |
---|---|
Author | Thomas Steinmaurer |
Post date | 2011-12-15T14:24:49Z |
> I've got data in a table containing timestamps in a timestamp column. Iselect
> want to group these by month.
>
> How?
>
> Anything simpler/better than this:
> substring(cast(T."TheTimestamp" as varchar(50)) from 1 for 7)
count(*)
, extract(month from mytimestamp)
from
t
group by
extract(month from mytimestamp)
You can speed up things on a large table by adding an expression index.
HTH.
--
With regards,
Thomas Steinmaurer
* Upscene Productions - Database Tools for Developers
http://www.upscene.com/
* My Blog
http://blog.upscene.com/thomas/index.php
* Firebird Foundation Committee Member
http://www.firebirdsql.org/en/firebird-foundation/