Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: group by hour?
On Tue, 08 Apr 1997 14:30:08 -0400, edwards_at_garland.dnr.state.sc.us wrote:
>is it possible to group by the hour or day of a date?
>
> select avg(temperature),date from weather
> group by date%DAY
>
>Does anyone know how to do this?
Here is an example with group by hours:
select to_char(DATUM,'yyyymmddhh24'), count(*) from TABELLE
where DATUM>=to_date('19960206000000','yyyymmddhh24miss') and
DATUM<to_date('19960207000000','yyyymmddhh24miss') group by to_char(DATUM,'yyyymmddhh24'); Received on Sun Apr 13 1997 - 00:00:00 CDT