'mysql copy to another only new records

I have to 2 tables:

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 are unical and it cant be same.

I need to copy only new records from lang temp to full_products. How it's possible do be query?



Solution 1:[1]

Try

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
 )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 peterm