Home » SQL & PL/SQL » SQL & PL/SQL » count of rows within 5 minute intervals (10g)
count of rows within 5 minute intervals [message #349659] Mon, 22 September 2008 09:49 Go to next message
awolff01
Messages: 1
Registered: September 2008
Location: North Carolina
Junior Member
Hello,

I have a table that stores a date and time. I would like to create a query that would summarize the record counts during 5 minute intervals intervals through-out the day?

Is this possible with just pl/sql...or will I need to create a view or something more complex?

Example:

Count, Date, Time Int
3, 09/22/09, 12:00 - 12:04
4, 09/22/09, 12:05 - 12:09
2, 09/22/09, 12:10 - 12:14
.
.
.
etc

Thanks
Re: count of rows within 5 minute intervals [message #349664 is a reply to message #349659] Mon, 22 September 2008 10:12 Go to previous messageGo to next message
annagel
Messages: 220
Registered: April 2006
Senior Member
Well it is hard to give a definitive answer, because details are a bit scarce in your question, but I would start with something like this:

SELECT     TRUNC (SYSDATE) + (5 * (ROWNUM - 1)) / (24 * 60) time_from,
           TRUNC (SYSDATE) + (5 * ROWNUM) / (24 * 60) time_to
      FROM DUAL
CONNECT BY ROWNUM <= 5 * (24 * 60)


and join it to the table you want to get the dates from, this will give you all the 5 minute intervals in the current day but you should be able to adapt it to your needs.
Re: count of rows within 5 minute intervals [message #349666 is a reply to message #349659] Mon, 22 September 2008 10:28 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Usenet, "Count per 10 minutes".

Regards
Michel
Previous Topic: Sequene problem with Insert All
Next Topic: Selecting specufuc column programmaticaly
Goto Forum:
  


Current Time: Sat Dec 10 16:28:07 CST 2016

Total time taken to generate the page: 0.08366 seconds