1 of 1 people found this helpful
Both queries will return a daily total, so either can be used. I would consider your first query would be the most appropriate in order to return the daily total for 2017-01-29. Summary functions in PI are based on a time range, and the first query explicitly defines that time range. As such, it also looks more intuitive to someone who is expecting to see the time range clearly defined.
The second query is syntactically correct in order to produce a daily total, but is actually calculating the total for 2017-01-28, which is why you see different values between the two queries. If you change the time in the second query to 2017-01-30 you will find that the two queries then produce the same result. Remember that a datetime that only shows the date portion defaults to midnight at the start of that date in PI. So the second query is starting at the beginning of the 29th, and working backwards with the specified timestep, thus calculating the daily total for the 28th.
You're ma man, you've made my day !
It could be difficult to apprehend PI database when you have to play with it without being a speciais. That subtility is now clear to me, I'll keep using the time range then.
Thanks a lot.
No problems, glad it helped!