I would like create a data query in SQL to incrementally number groups of rows, grouped on a common datetime and keep the \"group numbers\" incrementing on the next datetime
you shouldn't be using ROW_NUMBER(),
DENSE_RANK() insteadPARTITION BYquery,
SELECT hl.ts_DateTime,
hl.Tagname as [ID],
hl.TagValue as [Value],
DENSE_RANK() OVER (ORDER BY ts_datetime) AS RowFilter
FROM Table1 hl
ORDER BY RowFilter
I think you are looking for this:
ROW_NUMBER() OVER (PARTITION BY hl.id ORDER BY hl.ts_DateTime) AS RowFilter