Subject | Re: [firebird-support] group by date from timestamp? |
---|---|
Author | Arno Brinkman |
Post date | 2004-06-14T19:48:05Z |
Hi,
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
> I'm trying to get a count of records added per day. The table as aUse ordinal position in GROUP BY clause:
> 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.
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