abhas (9/16/2014)
Hi bros,I need to compare the next row with the previous row of same table and produce nonidentical column.
for eg... say
mytable has
Row 1 => 1001 Abhas 120 150 180
Row 2 => 1001 Abhas 150 150 180
then my output would be as below:
StudId Name fee1 fee2 fee3
1001 120
1001 Abhas 150 150 150
i.e in first row of resultset, i want to show only those values which are changed alongwith studID and next row should display all values.
Plz suggest me...
Thanks
Abhas.
The concept of "previous row" in SQL server is invalid if you're relying on perceived natural order. There has to be a column that contains a date, IDENTITY, or something that identifies the order of the rows.
If you'd like a code answer, please help us help you and read the article at the first link under helpful links in my signature line below. Thanks.
--Jeff Moden
Change is inevitable... Change for the better is not.