Subject | RE: [ib-support] Grouping by Year, Month?? |
---|---|
Author | Thomas Steinmaurer |
Post date | 2002-06-12T13:01:55Z |
Additional to Vince's answer, you could also create
COMPUTED BY columns to your table. For example:
YEAROF_DATA_CHEGADA COMPUTED BY ( extract(year from DATA_CHEGADA) )
MONTHOF_DATA_CHEGADA COMPUTED BY ( extract (month from DATA_CHEGADA) )
These computed by columns could be used in the GROUP BY too ...
Regards,
Thomas Steinmaurer
IB LogManager 2.0 - The Logging/Auditing Tool for InterBase and Firebird
http://www.iblogmanager.com
COMPUTED BY columns to your table. For example:
YEAROF_DATA_CHEGADA COMPUTED BY ( extract(year from DATA_CHEGADA) )
MONTHOF_DATA_CHEGADA COMPUTED BY ( extract (month from DATA_CHEGADA) )
These computed by columns could be used in the GROUP BY too ...
Regards,
Thomas Steinmaurer
IB LogManager 2.0 - The Logging/Auditing Tool for InterBase and Firebird
http://www.iblogmanager.com
> -----Original Message-----
> From: Clément Doss [mailto:cdoss@...]
> Sent: Wednesday, June 12, 2002 2:02 PM
> To: ib-support@yahoogroups.com
> Subject: [ib-support] Grouping by Year, Month??
>
>
> Hi All,
>
> I am using a DIALECT 1 database.
> I would like to group the records by Year/Month.
> The table contains severals entries for each day.
> I would like to sum by Year and month the totals.
> I already tried the following query :
>
> select extract( year from DATA_CHEGADA) as Ano,
> extract( month from DATA_CHEGADA) as Mes,
> TIPO,
> SUM (VALOR_COBERTO) as Total,
> sum(1) as Atendimentos
> from PDX_ATND23
> where DATA_CHEGADA between '01/01/1998' and '12/31/1998'
> group by
> extract( year from DATA_CHEGADA),
> extract( month from DATA_CHEGADA),
> TIPO
>
> order by TIPO, DATA_CHEGADA
>
> Statement #1:
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 9, char 6.
> extract.
>
> I guess the "group by extract" is not working for me. Any other
> suggestions?
> How can I achieve that?
>
> Best regards,
> Clément
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>