Hio Guys, I have the following SQL query;
INSERT INTO ps_ext_mod (id_order,product_reference,id_customer,email)
SELECT d.id_order, d.product_reference, o.id_customer, c.email
FROM ps_orders o
INNER JOIN ps_order_detail d ON d.id_order = o.id_order
INNER JOIN ps_customer c ON c.id_customer = o.id_customer
What I need to happen is to check the table ps_ext_mod if id_order already exists with the value to be inserted. If it does, then dont insert it.
You can just join back to the table and look for where the join fails, i.e.: