scott_lotus (8/15/2012)
I am trying to write a script to read the current row and previous row per device and work out the difference reporting values over X (> than 20 in example below).ID DEVICE VALUE
9 456 70
8 456 60
7 123 70
6 123 60
5 456 50
4 456 10
3 123 50
2 123 20
1 123 10
Script would return
ID 3
ID 5
Large table to be queried.
Thank you for any help.
Scott
There is no such thing as current row and previous row in a SQL table.
What do you mean by current row per device? Is the one with the largest ID?
How did you manage to calculate 3 and 5? Based on what?