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: SQL Select statement / Time & date question

Re: SQL Select statement / Time & date question

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Fri, 16 Jan 2004 16:16:00 +0100
Message-ID: <4007ffe5$0$1176$636a55ce@news.free.fr>

"ext237" <ext237_at_somewhere.com> a écrit dans le message de news:4007f272$0$48204$45beb828_at_newscene.com...
> Hi.
>
> Is there a way in SQL statement to count the number of records that updated
> per hour?
>
> For example, a table with these fields and records:
>
> trans_id trans_date
> --------- ------------
> 1 1/15/2004 12:18:33 PM
> 2 1/15/2004 2:07:01 PM
> 3 1/15/2004 2:10:12 PM
>
> I need my report to say:
>
> hour num_of_trans
> ---- --------------
> 12 PM 1
> 2 PM 2
>
> Any hints?
>
> THANKS!
>
> Joe
>

select trunc(trans_date,'HH') hour, count(*) nb from mytable;

Regards
Michel Cadot Received on Fri Jan 16 2004 - 09:16:00 CST

Original text of this message

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