Query advice: "WATTS per hour" difference in integer field against timestamp field, per-hour for result set
Posted by: Erich Stein
Date: June 16, 2018 11:28AM

I have experience querying data. This query has me confused, I do not know how to search for the answer to this on my own. The answer could probably be easy or obvious with someone else with more experience and different set of eyes, please help.

I am looking to SELECT a result set, that compares the difference in a INTEGER field in the table against a given time range.

The table has a dateTime field and a integer field (totalWatts). The logger program inserts records on a semi-irregular interval. Example;

________________________________________
dateTime___________________totalWatts
________________________________________
2008-06-16 10:02:30________0
2008-06-16 10:12:32________3
2008-06-16 10:16:33________9
2008-06-16 10:24:31________12
2008-06-16 10:48:31________13
2008-06-16 11:01:36________16
2008-06-16 11:14:36________24
2008-06-16 11:45:36________24
________________________________________

For the SELECT statement, I want to designate # of seconds (example 900 for 15 minutes). The result set should be a row for each 900 second interval (or any interval, 3600 for 1 hour, 86,400 for 1 day). The "per15" field would be the difference of watts within that given range of time (900 seconds = 15 minutes).

interval___________________per15
________________________________
2008-06-16 10:00:00________0
2008-06-16 10:15:00________3
2008-06-16 10:30:00________9
2008-06-16 10:45:00________0
2008-06-16 11:00:00________4
2008-06-16 11:15:00________8
2008-06-16 11:30:00________0
2008-06-16 11:45:00________0
_________________________________

Can anyone advice me how to do this ?

Options: ReplyQuote


Subject
Written By
Posted
Query advice: "WATTS per hour" difference in integer field against timestamp field, per-hour for result set
June 16, 2018 11:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.