Hi
Thanks for your help. Lets just get the problem 100% clear. Maybe my first description isn't entirely clear.
I need the minimum reading in the first interval (intervalStart) of each device and the minimum reading in the next interval (nextIntervalStart) for each device. Then getting the difference of the 2 might be easier...I hope.
As for doing it in Java, it's possible. I'll just have to construct something like a hashMap to keep the readings of each device together where the deviceId is the key in the map and a list of readings as the values. In the end, I'm going to run this query for a number of successive intervals (intervalStart := nextIntervalStart and nextIntervalStart := nextIntervalStart + someInterval) So I'll have the delta consumption per device for each interval.
I thought it would be quicker if the db does the processing?
Kind regards
Main Topics
Browse All Topics





by: VenabiliPosted on 2008-09-09 at 03:15:13ID: 22425698
OK - so you need a query to find the difference between the total minimal value and the minimal value for only part of the column (the rows where the timestamp >nextIntervalStart? I'll see if I can come up with an idea here
All things considered - won't it actually be easier to run two different quieries and to do the extraction in the Java code?