Skip to content
Advertisement

SQL difference between cell values (LAG function not working)

Unfortunately I can’t use the lag function due to using SQL Server 2008.

I need to find machine based difference between two values at different times.

I have a table like that:

I need to find a difference (76340-75000 = 1340) between id 1 and 3.

Tried these before:

but it compares with t1.id with the whole table.

I can’t use lag function – thank you very much for your help.

Advertisement

Answer

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement