Use two equality operators for comparison with cyclic retrieval and resolution
- Last UpdatedMar 19, 2025
- 1 minute read
If the time range is specified using >= and <=, then the first row falls exactly on the start time. The last row will fall exactly on the end time, if the resolution divides exactly into the specified time duration. If the resolution does not divide exactly into the specified time duration, then the last row returned will be the last row satisfying (start date + N*resolution) which has a timestamp less than the end date.
In short:
-
<= endtime MAY return a last row containing the exact endtime (but it is not guaranteed to do so)
-
< endtime is guaranteed NOT to return a last row containing the exact endtime
This query sets the resolution to 1 second.
SELECT DateTime, Value
FROM History
WHERE TagName = 'SysTimeSec'
AND wwResolution = 1000
AND DateTime >= '2001-01-13 12:00:00'
AND DateTime <= '2001-01-13 12:01:00'
The results are:
|
DateTime |
Value |
|
2001-01-13 12:00:00.000 |
0 |
|
2001-01-13 12:00:01.000 |
1 |
|
2001-01-13 12:00:02.000 |
2 |
|
2001-01-13 12:00:03.000 |
3 |
|
2001-01-13 12:00:04.000 |
4 |
|
... |
|
|
2001-01-13 12:00:56.000 |
56 |
|
2001-01-13 12:00:57.000 |
57 |
|
2001-01-13 12:00:58.000 |
58 |
|
2001-01-13 12:00:59.000 |
59 |
|
2001-01-13 12:01:00.000 |
0 |
(61 row(s) affected)