Maximum retrieval - query 1
- Last UpdatedFeb 06, 2025
- 1 minute read
In this example, an analog tag is retrieved over a five-minute period, using the maximum retrieval mode. Because the wwResolution parameter is set to 60000, each cycle is exactly one minute long. The maximum data value is returned from each of these cycles.
SELECT DateTime, TagName, CONVERT(DECIMAL(10, 2), Value) AS Value FROM History
WHERE TagName = 'ReactTemp'
AND DateTime >= '2005-04-11 11:21:00'
AND DateTime <= '2005-04-11 11:26:00'
AND wwRetrievalMode = 'Maximum'
AND wwResolution = 60000
The initial value at the query start time is the maximum value found in the phantom cycle before the start time of the query.
The results are:
|
Cycle |
DateTime |
TagName |
Value |
|---|---|---|---|
|
(phantom cycle) |
2005-04-11 11:21:00.000 |
ReactTemp |
196.00 |
|
(cycle 1) |
2005-04-11 11:21:00.853 |
ReactTemp |
101.70 |
|
(cycle 2) |
2005-04-11 11:22:40.837 |
ReactTemp |
196.00 |
|
(cycle 3) |
2005-04-11 11:23:00.833 |
ReactTemp |
159.20 |
|
(cycle 4) |
2005-04-11 11:24:59.613 |
ReactTemp |
146.00 |
|
(cycle 5) |
2005-04-11 11:25:12.083 |
ReactTemp |
196.00 |