Specifying the start date with ">"
- Last UpdatedMar 19, 2025
- 2 minute read
If the start date is specified using > (greater than), then the first row returned is the first valid change after (but not including) the start date. No initial value row is returned. A query that uses > to specify its start date may return zero rows.
Query 1
For this query, the first row that will be returned will be the first valid change after (but not including) the start time (12:00:30):
SELECT DateTime, Value, Quality
FROM History
WHERE TagName = 'SysTimeMin'
AND wwRetrievalMode = 'Delta'
AND DateTime > '2001-01-13 12:00:30'
AND DateTime < '2001-01-13 12:10:00'
The first row returned is the first valid change after (but not including) the start time (12:00:30):
|
DateTime |
Value |
Quality |
|
2001-01-13 12:01:00.000 |
1 |
0 |
|
2001-01-13 12:02:00.000 |
2 |
0 |
|
2001-01-13 12:03:00.000 |
3 |
0 |
|
2001-01-13 12:04:00.000 |
4 |
0 |
|
2001-01-13 12:05:00.000 |
5 |
0 |
|
2001-01-13 12:06:00.000 |
6 |
0 |
|
2001-01-13 12:07:00.000 |
7 |
0 |
|
2001-01-13 12:08:00.000 |
8 |
0 |
|
2001-01-13 12:09:00.000 |
9 |
0 |
(9 row(s) affected)
Query 2
For this query, the start date will correspond to a data change, but it will be excluded from the result set because the operator used is greater than, not greater than or equal to.
SELECT DateTime, Value, Quality
FROM History
WHERE TagName = 'SysTimeMin'
AND wwRetrievalMode = 'Delta'
AND DateTime > '2001-01-13 12:01:00'
AND DateTime < '2001-01-13 12:10:00'
The start time (12:01:00) corresponds exactly with an actual change in value, but it is excluded from the result set because the operator used is greater than, not greater than or equal to.
|
DateTime |
Value |
Quality |
|
2001-01-13 12:02:00.000 |
2 |
0 |
|
2001-01-13 12:03:00.000 |
3 |
0 |
|
2001-01-13 12:04:00.000 |
4 |
0 |
|
2001-01-13 12:05:00.000 |
5 |
0 |
|
2001-01-13 12:06:00.000 |
6 |
0 |
|
2001-01-13 12:07:00.000 |
7 |
0 |
|
2001-01-13 12:08:00.000 |
8 |
0 |
|
2001-01-13 12:09:00.000 |
9 |
0 |
(8 row(s) affected)
Query 3
This query will return no rows, because no data changes are captured:
SELECT DateTime, Value, Quality
FROM History
WHERE TagName = 'SysTimeMin'
AND wwRetrievalMode = 'Delta'
AND DateTime > '2001-01-13 12:00:30'
AND DateTime < '2001-01-13 12:01:00'
The query does not capture an actual change in value; therefore, no rows are returned.
|
DateTime |
Value |
Quality |
(0 row(s) affected)