UPDATE vn.claim c JOIN vn.claimState cs ON cs.id = c.claimStateFk JOIN vn.claimState ns ON ns.code = 'resolved' SET c.claimStateFk = ns.id WHERE cs.code IN ('managed', 'mana', 'lack', 'relocation'); DELETE FROM vn.claimState WHERE code IN ('managed', 'mana', 'lack', 'relocation');