首页 > 数据库技术 > 详细

mysql update 四种情况

时间:2014-03-01 18:01:19      阅读:596      评论:0      收藏:0      [点我收藏+]

级联更新第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

mysql update 四种情况,布布扣,bubuko.com

mysql update 四种情况

原文:http://guitarboy.blog.51cto.com/3121650/1365170

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!