Subject Re: group by date from timestamp?
Author kimon_the_athenian2
Hi!

maybe you can use this:

Select
extract(year from added),
extract(month from added),
extract(day from added),
count(*)
from foo
group by
extract(year from added),
extract(month from added),
extract(day from added)

or maybe you can find some udf that extracts date from timestamp
(there seems to be something in rfunc (rfunc.sourceforge.net)),
but I'm not sure if it's possible to group by UDF, though.

Aivar


--- In firebird-support@yahoogroups.com, "Matzen, John"
<jmatzen@s...> wrote:
> 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.
>
>
>
> Any thoughts?
>
>
>
>
>
> [Non-text portions of this message have been removed]