|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Wednesday, April 17, 2013 9:26 PM
Points: 20,
Visits: 289
|
|
Hi,
I need to compare concecutive records in a single table and find the difference of 1 column .
Iam grouping with rownumber ,but how do I compare the row 2 with row 1 row3 with row2 and get the difference.
Thanks for your help.
Demin
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 7:53 AM
Points: 882,
Visits: 810
|
|
Hi, if you have the row number for the table already you could join this table in on itself as below allow you to join one row to the next
SELECT table1.column1, table2.column2 FROM Sampletable as table 1 LEFT OUTER JOIN Sampletable as table2 ON table1.rownumber+1 = table2.rownumber
|
|
|
|