AnsweredAssumed Answered

Crude oil statistic by query

Question asked by igreguri Champion on Nov 16, 2018
Latest reply on Nov 19, 2018 by Eugene Lee

I made a query that extracts crudes (names) for a specific time period. Daily quantities are in some second PI point.

How to calculate in the same query total sum, min, average and max for each crude, in period when it was processed?

Ending time for processing one crude is the start of processing another crude.


format (time,'dd.MM.yyyy hh:mm') as StartTime,
CAST(value as string) as Crude
FROM piarchive..picomp2
WHERE Tag Like 'Crude.PV' and value is not null
ORDER by time DESC