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
WHERE Tag Like 'Crude.PV' and value is not null
ORDER by time DESC