mysql联合查询更新数据库例子

mysql联合查询更新数据库例子,用户表,部门表,把用户表中的部门属性更新为部门表的主键
UPDATE user_table AS ut
INNER JOIN belongdept AS bd ON bd.`name`=ut.`belongDept`
SET ut.`belongDept` =bd.id

原文地址:https://www.cnblogs.com/oymx/p/4538028.html