If you change the order so that a positive value come before a negative one (SHAMT = 60), then you can use the LAG and LEAD functions. If that is not an option, then things get more difficult.CREATE TABLE #Temp(ID INT IDENTITY(1,1),[SHCOMP] [numeric](7, 0) NOT NULL,[SHDESC] [char](35) NOT NULL,[SHTYPE] [char](1) NOT NULL,[SHAMT] [numeric](9, 2) NOT NULL,[CBLNAM] [char](30) NOT NULL,)INSERT #Temp (SHCOMP, CBLNAM, SHDESC, SHAMT, SHTYPE)VALUES(123, 'cust1', 'desc1',45, 'F'),(123, 'cust1', 'desc1',-45, 'T'),(123, 'cust1', 'desc1',45, 'F'),(123, 'cust1', 'desc1',-45, 'T'),(123, 'cust1', 'desc1',45, 'F'),(123, 'cust1', 'desc1',-35, 'T'),(234, 'cust3', 'desc2',60, 'T'), -- Reversed(234, 'cust3', 'desc2',-60, 'F'), -- Reversed(234, 'cust3', 'desc2',30, 'F'),(234, 'cust3', 'desc2',-30, 'T'),(234, 'cust3', 'desc2',30, 'F')SELECT * ,CASE WHEN ( SHAMT > 0 AND SHAMT + NextVal = 0 ) OR ( SHAMT < 0 AND SHAMT + PreviousVal = 0 ) THEN 'Remove' ELSE NULL ENDFROM ( SELECT * ,LEAD(SHAMT, 1, 0) OVER (ORDER BY ID) AS NextVal ,LAG(SHAMT, 1, 0) OVER (ORDER BY ID) AS PreviousVal FROM #Temp ) AS T