我有2张桌子:
lang temp:
sku|postid|fi|en|ru (15000 records / included 200 full_products records)
full_products:
sku|postid|fi|en|ru|xx|zzz|aaaa|bbb (200 records)
postid是单一的,它不能相同。
我只需要将lang temp中的新记录复制到full_products。怎么可能是查询?
答案 0 :(得分:0)
尝试
INSERT INTO full_products (sku,postid,fi,en,ru)
SELECT sku,postid,fi,en,ru
FROM lang_temp l
WHERE NOT EXISTS
(
SELECT 1
FROM full_products
WHERE post_id = l.post_id
AND sku = l.sku
)