Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Select statement / Time & date question
Whaoh ... LOL, I can't believe it was this simple! Thanks to the 2
people who replied!
On Fri, 16 Jan 2004 15:54:31 +0100, Thomas Kellerer <spam_eater_at_gmx.net> wrote:
>ext237 schrieb:
>
>> 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?
>>
>
>select to_char(trans_date, 'HH24'), count(*)
>from table
>group by to_char(trans_date, 'HH24')
Received on Fri Jan 16 2004 - 16:52:15 CST
![]() |
![]() |