Hello,

In my following simple code I am trying to compare the values of a column between the current row and the previous row and then out put the results if the values are same. How I can I do that? Also when I print the colum from first row and then from next row, why it is giving me the same result? Thanks.

Following is my code:

DECLARE
@abc float,
@def datetime,

@abc2 float,
@def2 datetime


DECLARE downTime SCROLL CURSOR FOR
select D_ABC, D_DEF from tab1

OPEN downTime
FETCH First FROM downTime INTO @abc,@def
FETCH NEXT FROM downTime INTO @abc2,@def2

print @abc
print @abc2


WHILE (@@FETCH_STATUS=0)

BEGIN

// Out here I want to print the rowID's of those rows where @abc = @abc2

END
CLOSE downTime