Subject | Re: [ib-support] GROUP BY ON MONTH or YEAR of DATE FIELDS |
---|---|
Author | Milan Babuskov |
Post date | 2003-01-17T11:31:14Z |
enricorav wrote:
view that uses EXTRACT like this:
CREATE VIEW v1
AS
SELECT extract(month from rate_reg), extract(year from date_reg), ...
from my_table;
Later you select from that view and group by this new fields.
HTH
Milan Babuskov
http://fbexport.sourceforge.net
> Hi to all,You can use some MONTH() and YEAR() UDFs, and group by it, or write a
> there are some methods for make a SELECT with GROUP BY on a part of a
> DATE or TIMESTAMP fields?
> Something like this:
>
> SELECT ...
> FROM MY_TABLE
> ...
> GROUP BY MONTH(DATE_REG), YEAR(DATE_REG)
>
> where DATE_REG are a DATE fields or TIMESTAMP fields ?
view that uses EXTRACT like this:
CREATE VIEW v1
AS
SELECT extract(month from rate_reg), extract(year from date_reg), ...
from my_table;
Later you select from that view and group by this new fields.
HTH
Milan Babuskov
http://fbexport.sourceforge.net