STATISTIC |
Non-Interpolated SQL Query |
Interpolated SQL Query |
AVERAGE |
SELECT avg(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
SELECT avg(value) FROM piarchive..piavg WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
TOTAL |
SELECT sum(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
SELECT sum(value) FROM piarchive..pitotal WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
MINIMUM |
SELECT min(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
SELECT min(value) FROM piarchive..pimin WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
MAXIMUM |
SELECT max(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
SELECT max(value) FROM piarchive..pimax WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') |
FIRST |
SELECT top 1 time,value FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') order by time asc |
SELECT TOP 1 time,value FROM piarchive..piinterp2 WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00')ORDER BY Time ASC |
LAST |
SELECT top 1 time,value FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') order by time desc |
SELECT TOP 1 time,value FROM piarchive..piinterp2 WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') ORDER BY Time DESC |
DIFF |
- Get FIRST value
- Get LAST value
- RESULT = LAST - FIRST
- IF RESULT < 0 THEN (10 ^ (Ceil(LOG(first_value) / LOG(10)))) - first_value + last_value
|
No Change, except the query it uses for each part (FIRST and LAST) |
RANGE |
- Get MIN value
- Get MAX value
- Get ABS(MIN - MAX)
|
No Change, except the query it uses for each part (MIN and MAX) |
INVENTORY |
1. SELECT time,value FROM piarchive..piinterp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') AND Value <> 'Bad' AND timestep = '2m' ORDER BY Time ASC
2. Loop throught the records returned and sum the downward trends greater than the Deadband
|
No Change |
TIMEGT(x) |
SELECT count(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') and value > 13 |
No Change unless .I is used on statistic TIMEGT(x).I
piinterp2 table will be used. Timestep will be added to the query |
TIMEGE(x) |
SELECT count(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') and value >= 13 |
No Change unless .I is used on statistic TIMEGE(x).I
piinterp2 table will be used. Timestep will be added to the query |
TIMELT(x) |
SELECT count(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') and value < 13 |
No Change unless .I is used on statistic TIMELT(x).I
piinterp2 table will be used. Timestep will be added to the query |
TIMELE(x) |
SELECT count(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') and value <= 13 |
No Change unless .I is used on statistic TIMELE(x).I
piinterp2 table will be used. Timestep will be added to the query |
TIMEEQ(x) |
SELECT count(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') and value = 13 |
No Change unless .I is used on statistic TIMEEQ(x).I
piinterp2 table will be used. Timestep will be added to the query |
TIMENE(x) |
SELECT count(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') and value <> 13 |
No Change unless .I is used on statistic TIMENE(x).I
piinterp2 table will be used. Timestep will be added to the query |
CYCLE(x) |
SELECT count(value) as value FROM piarchive..picomp p WHERE p.tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') and value = 0
|
No Change |
COUNT |
SELECT count(value) FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00')
|
No Change |
MOST |
SELECT COUNT(*) as thecount, digstring(status) as status FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') AND Value <> 'Bad' GROUP BY status ORDER BY thecount DESC
|
No Change |
MINTIME |
SELECT top 1 time, min(value) as mvalue FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') group by time order by mvalue asc |
No Change |
MAXTIME |
SELECT top 1 time, max(value) as mvalue FROM piarchive..picomp WHERE Tag = 'SOURCETAG' AND time >= date('25-May-2009 00:00:00') AND time < date('26-May-2009 00:00:00') group by time order by mvalue asc |
No Change |