Subject Re: [firebird-support] group by date from timestamp?
Author Arno Brinkman
Hi,

> I'm trying to get a count of records added per day. The table as a
> timestamp field.
>
> I can do this:
>
> Select extract( day from added ), count(*) from foo group by extract(
> day from added );
>
> But the following does not work:
>
> Select cast( added as date ) , count(*) from foo group by cast( added as
> date );
>
> Unfortunately the extract isn't really what I need.

Use ordinal position in GROUP BY clause:

SELECT
CAST(added AS DATE),
Count(*)
FROM
Foo
GROUP BY
1

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/

Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://80.126.130.81