I am trying to create a query that will subtract the current row of a column from the previous row, and if the value is negative, just return the value of the current column in the result column. For example, if I had the table below, here are the results I would like to see:
Key value REQUIRED RESULT
1 12 12
2 21 9
3 3 3
4 1 1
5 67 66
I have no idea how to do this, thanks for your help!
Key value REQUIRED RESULT
1 12 12
2 21 9
3 3 3
4 1 1
5 67 66
I have no idea how to do this, thanks for your help!