Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: group by hour?

Re: group by hour?

From: Keystroke <keystrk_at_feist.com>
Date: 1997/04/14
Message-ID: <33517c89.503862457@news.feist.com>#1/1

On Sun, 13 Apr 1997 11:24:33 +0000, Chrysalis <cellis_at_iol.ie> wrote:

>select to_char(<date_column>,'dd-Mon-yyyy hh24'),avg(temperature)
>from ...
>group by to_char(date_column,'dd-Mon-yyyy hh24');

Better yet:

select to_char(to_date(date_column, 'yyyymmddhh24'), 'mm/dd/yy hh pm')

    date_column, avg_temp
  from
(
 select to_char(<date_column>, 'yyyymmddhh24') date_column,

     avg(temprature) avg_temp
   from <some_table>
   group by to_char(<date_column>, 'yyyymmddhh24') ) v1
;

That way it will come back in proper order, but still be 'human readable' in the customary date & time format. Received on Mon Apr 14 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US