Subject | Re: [ib-support] Group by |
---|---|
Author | Arno Brinkman |
Post date | 2003-02-21T10:19:46Z |
Hi,
Reading my post i saw i pressed send to quickly :-)
Yes, create a VIEW (Nice workaround) with
SELECT CAST(MyDate AS DATE), Field1 FROM MyTable
and
SELECT V.F1, SUM(V.F2) FROM VIEW V GROUP BY V.F1
and i have seen "hacks" by using a UDF (in your case the udf must pass the
date and return it)
SELECT
UDF(CAST(MyDate AS DATE)),
SUM(Field1)
FROM
MyTable
GROUP BY
UDF(CAST(MyDate AS DATE))
b.t.w. : In FB1.5 (still beta) you can use :
SELECT
CAST(MyDate AS DATE),
Sum(Field1)
FROM
MyTable
GROUP BY
1
Regards,
Arno Brinkman
Reading my post i saw i pressed send to quickly :-)
> SelectIBx, FB1.0.x
> MyDate
> Sum(Field1)
> from MyTable
> Group by MyDate.
>
> This results gives me a lot of records of the same day because of the
> time.
> I would like to eliminate the time, so to get a sum of the entire day.
>
> Is this posible ?
Yes, create a VIEW (Nice workaround) with
SELECT CAST(MyDate AS DATE), Field1 FROM MyTable
and
SELECT V.F1, SUM(V.F2) FROM VIEW V GROUP BY V.F1
and i have seen "hacks" by using a UDF (in your case the udf must pass the
date and return it)
SELECT
UDF(CAST(MyDate AS DATE)),
SUM(Field1)
FROM
MyTable
GROUP BY
UDF(CAST(MyDate AS DATE))
b.t.w. : In FB1.5 (still beta) you can use :
SELECT
CAST(MyDate AS DATE),
Sum(Field1)
FROM
MyTable
GROUP BY
1
Regards,
Arno Brinkman