两表:
update table_one a inner join table_two b on a.name = b.name set a.num_id = b.id;
table_one 表中的 name 字段和 table_two 中的 name 字段值相等,就将 table_two 表的 id 值写入table_one 表的 num_id 字段
三表:
UPDATE pd_sku psk , (SELECT
ps.id
FROM
pd_spu ps
LEFT JOIN common_dictionary cd ON ps.product_type = cd.`value`
AND cd.group_identification = 'productType'
WHERE
ps.choose_user_name = 'admin') t SET psk.image = 'xxx' WHERE psk.spu_id = t.id