mysql update 四种情况
级联更新第1种情况:
update t1, t2
set t1.x = t2.x, t1.y = t2.y
where t1.id = t2.id
级联更新第2种情况:
update t1,
(select * from t2) as t2
set t1.x = t2.x, t1.y = t2.y
where t1.id = t2.id
级联更新第3种情况:
update (select c from t1 group by c) as temp, t2, t1
set t1.x = t2.x, t1.y = t2.y
where t1.id = t2.id and temp.id = t2.id
级联更新第4种情况:
update t1 left join t2 on t1.id = t2.id
set t1.x = t2.x, t1.y = t2.y
where t1.id = xx
本文出自 “晴朗” 博客,请务必保留此出处http://guitarboy.blog.51cto.com/3121650/1365170
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。