MySQL多表join时候update更新数据的方法
2022-11-12 09:24:54
内容摘要
这篇文章主要为大家详细介绍了MySQL多表join时候update更新数据的方法,具有一定的参考价值,可以用来参考一下。
对此感兴趣的朋友,看看idc笔记做的技术笔记!sql语句:
代码如下:
文章正文
这篇文章主要为大家详细介绍了MySQL多表join时候update更新数据的方法,具有一定的参考价值,可以用来参考一下。
对此感兴趣的朋友,看看idc笔记做的技术笔记!
sql语句:代码如下:
1 2 3 | <code>update item i,resource_library r,resource_review_link l set i.name=CONCAT( 'Review:' ,r.resource_name) where i.item_id=l.instance_id and l.level= 'item' and r.resource_id=l.resource_id and i.name= '' </code> |
代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <code> update a set a.schoolname = b.schoolname from tb_Std as a join tb_Sch as b on a.School = b.School where a.std_year = 2005 go /* (2 row(s) affected) */ select * from tb_Std as a join tb_Sch as b on a.School = b.School /* A School A A School 2 2005 A A School A A School 3 2004 C A School C C School 4 2005 D D School D D School (4 row(s) affected) */ </code> |
代码如下:
1 2 3 4 5 6 | <code> delete a from table1 a, table2 b where a.col1 = b.col1 and a.col2 = b.col2 </code> |
注:关于MySQL多表join时候update更新数据的方法的内容就先介绍到这里,更多相关文章的可以留意
代码注释