Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL group row count by time intervals of 5 minutes for last 15 min

807623Aug 21 2019 — edited Aug 22 2019

Hello

I have an application that gathers and stores data over time. Because of the applications reliance on the network and other functions the

data is gathered at irregular intervals.

The sample data is like this with:

Time_stamp                         

2010-11-16 10:30:00              

2010-11-16 10:31:00            

2010-11-16 10:32:00              

2010-11-16 10:33:00             

2010-11-16 10:33:44             

2010-11-16 10:36:44              

2010-11-16 10:37:44              

2010-11-16 10:41:44              

2010-11-16 10:43:44              

2010-11-16 10:44:44              

2010-11-16 10:55:44              

2010-11-16 10:57:44              

2010-11-16 10:58:44              

The Requirement is

I would like to summarize  the data in last 5 min interval from the give time ,assume if i have pass the  timestamp 2010-11-16 10:48:44  the output should be

Eg.

Record has to be counted between

2010-11-16 10:34:00 to 2010-11-16 10:38:00

2010-11-16 10:39:00 to 2010-11-16 10:43:00

2010-11-16 10:44:00 to 2010-11-16 10:48:00

Expected Result

interval_alias                          cnt

-------------------                       ----

2010-11-16 10:38:00                2

2010-11-16 10:43:00                2

2010-11-16 10:48:00                1

Kindly help  me in getting the above result.

Thanks,

V_B

This post has been answered by John_K on Aug 21 2019
Jump to Answer
Comments
Post Details
Added on Aug 21 2019
16 comments
9,682 views