I have a question and I'm not sure that I can explain my problem good enough. I need to select a record and to minus a value from previous record? I will send you data example what does the table contain:
Previous records are as follow 18,0,31,275.
Results should upear as below:
If you have any suggestion or solution you are welcome
Thanks in advanced
I hope this gives you the idea of what is needed
ON [t].[myID] = [t2].[myID] + 1
answered Aug 10 '11 at 03:52 AM
A horrible RBAR cte solution........
from cte c1
answered Aug 10 '11 at 04:00 AM
Kev Riley ♦♦
This doesn't help you right now, but I just want to give you something to wait for.
In the next version of SQL server (Denali) you would be able to calculate this with OVER clause like this, without any CTE, RBAR or cursor solutions:
Clean and simple! :) If you like to try it, download CTP3 of Denali.