SQL数据库表中两行数据互换
2个回答
展开全部
做列表上下移动的时候遇到过,改造了下可以看看
update student t set
t.name =
(case when t.id = '1'
then (select t2.name from student t2 where t2.id ='2')
else (select t2.name from student t2 where t2.id ='1')
end) where t.id in ('1','2')
update student t set
t.name =
(case when t.id = '1'
then (select t2.name from student t2 where t2.id ='2')
else (select t2.name from student t2 where t2.id ='1')
end) where t.id in ('1','2')
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询