try this DECLARE @Rooms TABLE( location VARCHAR(100), CheckinDay VARCHAR(100), checkindate DATETIME, roomtype VARCHAR(100), roomrate VARCHAR(100), executiontime DATETIME, id_num INT)INSERT INTO @Rooms SELECT 'Palms', 'Saturday', '8/30/2008', 'Florida', '199', '8/15/2008', 1 UNION ALLSELECT 'Palms', 'Saturday', '8/30/2008', 'Florida', 'SOLD', '8/8/2008', 2 UNION ALLSELECT 'Palms', 'Saturday', '8/30/2008', 'Atrium', '239', '8/8/2008', 3 UNION ALLSELECT 'Palms', 'Saturday', '8/30/2008', 'Atrium', '239', '8/15/2008', 4UPDATE RASET roomrate = 'SOLD'FROM @Rooms RAINNER JOIN (SELECT * FROM @Rooms WHERE roomrate = 'SOLD') RS ON RS.location = RA.location AND RA.CheckinDay = RS.CheckinDay AND RA.checkindate = RS.checkindate AND RA.roomtype = RS.roomtype AND RA.executiontime > RS.executiontime SELECT * FROM @Rooms
"There is only one difference between a dream and an aim. A dream requires soundless sleep to see, whereas an aim requires sleepless efforts to achieve..!!"