update tb set name = (case when id = 1 then ( select name from tb where id = 2) when id = 2 then ( select name from tb where id = 1) end) where id = 1 or id = 2;