Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> SQL : Howto do time intervals
Hi,
we are running Oracle 7 on a Sun Enterprise 10000. We have an orders table that has an entereddatetime date&time field. I have been tasked with creating a report that summarizes orders entered by half hour increments, eg:
select <time interval>, count(orderkey)
from orders
where
trunc(entereddatetime) = trunc(sysdate())
group by <time interval>
order by <time interval>;
I have a "formula" : (24hh*60+mi)/30 that should generate a sequential number allowing the grouping of the orders but haven't figured out what SQL will allow this in the select AND group and order by clauses.
It would be nice to convert the "interval" back into a "time" field so that it displays as 00:00 00:30 01:30, etc, if you care address that as well.
Thanks
Bill
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Sep 22 2000 - 10:35:33 CDT
![]() |
![]() |