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