最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
MySql多表关联Update更新sql语句
时间:2022-11-14 23:37:33 编辑:袖梨 来源:一聚教程网
对单表执行更新没有什么好说的,无非就是update table_name set col1 = xx,col2 = yy where col = zz,主要就是where条件的设置。有时候更新某个表可能会涉及到多张数据表,例如:
update table_1 set score = score + 5 where uid in (select uid from table_2 where sid = 10); 其实update也可以用到left join、inner join来进行关联,可能执行效率更高,把上面的sql替换成join的方式如下: update table_1 t1 inner join table_2 t2 on t1.uid = t2.uid set score = score + 5 where t2.sid = 10;
mysql关联多表进行update更新操作
UPDATE Track INNER JOIN MV ON Track.trkid=MV.mvid SET Track.is_show=MV.is_show WHERE trkid<6 等同于 UPDATE Track,MV SET Track.is_show=MV.is_show WHERE Track.trkid=MV.mvid and trkid<6
相关文章
- 地下城堡4骑士与破碎编年史初光神官有哪些流派 09-17
- 嘟嘟脸恶作剧克萝伊技能怎么样 09-17
- 新三国志曹操传驯马场有什么玩法 09-17
- 全境封锁曙光武器怎么获取 09-17
- 鹅鸭杀丧葬者如何玩 09-17
- 剑与远征启程沙利叶强技能怎么样 09-17