bswnaosn

Understanding the piavg table

Discussion created by bswnaosn on Apr 16, 2014
Latest reply on Apr 22, 2014 by Gregor

Hello all,

 

I am having some trouble understanding the result of one of my queries (through SQL Commander) against the piavg table. 

 

SELECT time, value
FROM [piarchive].[piavg]
WHERE tag = 'blah' AND time BETWEEN '16-Apr-2014 18:30:00' AND '16-Apr-2014 18:40:00' AND timestep = '1m'

 

Even though I had no entries in the archive for this tag between 18:35-18:40, I get values there. It looks like it is taking the last valid average (18:34) and using that when there are no records following.

 

What I would like to see, is  the average for the timestep if there are entries in the archive within that one minute range, and null if there are none.

 

Is this possible?

Outcomes