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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL : Howto do time intervals

Re: SQL : Howto do time intervals

From: Atta ur-Rehman <atta707_at_my-deja.com>
Date: Sun, 24 Sep 2000 07:09:37 GMT
Message-ID: <8qk9bc$s1b$1@nnrp1.deja.com>

hi bill,

i tried to think about doing it through trunc() function, but could really get to a solution!!! anyhow if you wanna do it through your own formula, this is how it would get transalted.

select
  round(((to_char(hd, 'hh24') * 60) + to_char(hd, 'mi'))/30) interval,   count(orderkey)
from
  orders
where
  trunc(entereddatetime) = trunc(sysdate()) group by
  round(((to_char(hd, 'hh24') * 60) + to_char(hd, 'mi'))/30) order by
  interval;

HTH ATTA In article <8qfu83$36s$1_at_nnrp1.deja.com>,   wbeacom_at_my-deja.com wrote:
> 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.
>

--

getting the meanin' of data...


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sun Sep 24 2000 - 02:09:37 CDT

Original text of this message

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