Use the GROUP BY clause
- Last UpdatedMar 20, 2025
- 1 minute read
The GROUP BY clause works if the query uses the four-part naming convention or one of the associated views.
The following example will find the highest value of a specified set of tags over a time period.
SELECT TagName, Max(Value)
FROM INSQL.Runtime.dbo.History
WHERE TagName IN ('ReactTemp','ReactLevel','SysTimeSec')
AND DateTime > '2001-12-20 0:00'
AND DateTime < '2001-12-20 0:05'
GROUP BY TagName
The results are:
|
SysTimeSec |
59.0 |