79724976

Date: 2025-08-04 13:45:37
Score: 1.5
Natty:
Report link

I used the LAG() window function to subtract the the previous row’s value:

SELECT DateTimeStamp, DMS1, DMS1 - LAG(DMS1) OVER (ORDER BY DateTimeStamp) AS HourlyDMS1 FROM vPLANTDATA ORDER DateTimeStamp;

The documentation for LAG() is found here : https://learn.microsoft.com/en-us/sql/t-sql/functions/lag-transact-sql?view=sql-server-ver17

I tried the following query and got this op:

op from query run

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Rajeev KR