Suthish Nair

Suthish Nair

  • NA
  • 30.5k
  • 7.2m

Save previous row value to next row..

Mar 24 2011 6:37 AM

 Having..

 ID  Date                              N1     N2 
 1   2009-01-01 00:00:00.000  100  99
 2   2009-01-02 00:00:00.000  0     0
 3   2009-01-03 00:00:00.000  0     0
 4   2009-01-04 00:00:00.000  0     0
 5   2009-01-05 00:00:00.000  0     0


 Output needed..

 ID  Date                              N1     N2
 1   2009-01-01 00:00:00.000  100  99
 2   2009-01-02 00:00:00.000  99    80
 3   2009-01-03 00:00:00.000  80    70
 4   2009-01-04 00:00:00.000  70    50
 5   2009-01-05 00:00:00.000  50    40


 Without using cursors.



Answers (3)