每日一题:用一个SQL语句交换两条数据某一列的值

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;

  

原文地址:https://www.cnblogs.com/mljqqh/p/14141508.html