Two questions:Do you care which one of the three you change from FBC to AB? If you do, you will some way to order the rows. For example, is there a date column or a serial number? If so we could use that.What do you want to do if there are more than three rows with leaveid = 12 for the same EMPID? Do you want to update all except two?Assuming you don't care about which one(s) you update, and you want to update all except two, here is one way of doing it:with a as( select *, row_number() over (partition by empid, leaveid order by (select null)) as rowId from YourTable where leaveId = 12)update a set remarks = 'ab', leaveid = 1where rowId >= 3