ROW_NUMBER() is not available in MS SQL 2000.So this is the alternative solutionI assumed that if there is single refnumber then that has to be marked as 1 ( i.e. RecentDate) DECLARE @example TABLE(refnumber VARCHAR(20), dateadded date, cancelled BIT)INSERT INTO @exampleSELECT '48394A0021', '2002-01-01', 0 union all -- Single refnumberSELECT '54739A0040', '2002-01-01', 0 union all -- Single refnumberSELECT '54739A0150', '2002-01-01', 0 union allSELECT '54739A0150', '2004-01-01', 1 -- marked as 1 b'coz latest record for refnumber '54739A0150'UPDATE @example SETcancelled = 1 FROM @example e JOIN (SELECT refnumber, MAX(dateadded) RecentDate FROM @example GROUP BY refnumber ) tON e.refnumber= t.refnumber AND e.dateadded= t.RecentDate
--Chandu