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

Home -> Community -> Usenet -> c.d.o.server -> Re: Summary the data according to the time

Re: Summary the data according to the time

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 4 Sep 1999 17:15:46 GMT
Message-ID: <7qrk42$3el$2@news.seed.net.tw>

<lily99_at_my-deja.com> wrote in message news:7qp3hk$pv1$1_at_nnrp1.deja.com...
> Hi,
> I have a log table which has file_size and date/time
> fields. I want to summary file_size based on every ten
> minutes. I read some Oracle books, but still cannot figure
> out how I can do this. Can someone help me with this issue?
> Thanks you very very much.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

It's a interesting question.
Since the built-in function can not perform truncate a date datatype to 10 minutes, It needs a trick to do, like the following:

select trunc(sysdate)+floor((datetime-trunc(sysdate))*144)/144, sum(file_size)   from log_table
  group by trunc(sysdate)+floor((datetime-trunc(sysdate))*144)/144;

The result will look like:

TRUNC(SYSDATE)+TRUN SUM(FILE_SIZE)

------------------- --------------
1999/09/04 06:00:00             91
1999/09/04 06:10:00            344
1999/09/04 06:20:00            600
1999/09/04 06:30:00            856
1999/09/04 06:40:00           1112
1999/09/04 06:50:00           1368
1999/09/04 07:00:00            679






Received on Sat Sep 04 1999 - 12:15:46 CDT

Original text of this message

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