I want to Insert the values only if they are not already exits. My table is called wp_all_import
and my values called pid
, price
, price_old
, shop
and link
.
Can anybody please tell me whats wrong here? Because he inserts the values nevertheless they exits already...
INSERT INTO `wp_all_import` ('$pid', '$price', '$price_old', '$link', '$shop')
SELECT 'pid', 'price', 'price_old', 'shop', 'link' FROM `wp_all_import`
WHERE NOT EXISTS (SELECT * FROM `wp_all_import`
WHERE (pid = '$rpid') AND (price = '$rprice') AND (price_old = '$rprice_old') AND (shop = '$rshop') AND (link = '$rlink'))
Greetings and Thank You!