Subject | Re: [firebird-support] Group by on a timestamp field |
---|---|
Author | Ann W. Harrison |
Post date | 2005-02-03T17:23:36Z |
williamvdw2004 wrote:
You'll need to group by an expression ... probably an extract.
e.g,
select extract (year from timesent), extract (yearday from
timesent), extract (hour from timesent), extract (minute from timesent),
timesent,
count(*) from ... group by 1, 2, 3, 4
Regards,
Ann
>Group by works on exact values and time is expressed in seconds.
> I am trying get the "messages per minute" rate.
>
> Here is a sample of my current sql statment (which seems to return
> messages per second).
>
> select timesent,count(*) from messages group by timesent
>
You'll need to group by an expression ... probably an extract.
e.g,
select extract (year from timesent), extract (yearday from
timesent), extract (hour from timesent), extract (minute from timesent),
timesent,
count(*) from ... group by 1, 2, 3, 4
Regards,
Ann