https://blog.csdn.net/skychaseryu/article/details/81773465
3.如果您需要只导入目标表中不存在的记录,可以使用这种方法:
INSERT INTO 目标表 (字段1, 字段2, ...) SELECT 字段1, 字段2, ... FROM来源表
WHERE not exists (select * from 目标表 where 目标表.比较字段 = 来源表.比较字段);
关联跟新
UPDATE a as p JOIN b as pp
SET p.brand_id = pp.brand_id
WHERE p.spec_group_code = pp.`code`