I think your issue is to prevent the wrong depno's in the database in the first place.
Otherwise, I don't see any usable logic to determine which rows need to get updated.
Something like:
UPDATE [Table] SET depno = 20 WHERE id IN (SELECT id FROM [Table Employee] WHERE [Column 1] IN (id's that need to be updated to 20))
Post the logic and please look at why the wrong depno is getting saved to the table in the first place.
|