I've got some data populated in a table and I would like to calculate the difference between row values in a particular order.
The data is like this:
so I would like to do a select which provides a list of differences and the second value uid:
Is there any way to do this in SQL? I'm guessing I need to do some sort of self join, but ?
I want to do this in SQL if possible as there will be thousands of rows so extracting it all into a script and calculating it would be slow.
Thanks for you help,