Subject | Re: [ib-support] Grouping by Year, Month?? |
---|---|
Author | Vince Duggan |
Post date | 2002-06-12T12:32:15Z |
Create a view that selects the 'raw' data, and then select from the view,
grouping by whatever.
create view xxx (f1,f2,....)
as
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'
Then select * from xxx
group by f1,f2,f3
Vince
grouping by whatever.
create view xxx (f1,f2,....)
as
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'
Then select * from xxx
group by f1,f2,f3
Vince
----- Original Message -----
From: Clément Doss <cdoss@...>
To: <ib-support@yahoogroups.com>
Sent: Wednesday, 12 June, 2002 2:02 PM
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/
>
>