I'm trying to convert this SELECT
statement to an UPDATE
statement but it's too hard. I don't even know if I can keep INNER JOIN
s while updating, so I think I need some help from an SQL genius.
I need to update my customer ID on liste_objectif where it's NULL, and I have this id on customers table (by the mail)
SELECT DISTINCT *
FROM liste_objectifs l
INNER JOIN customers c ON ( l.email = c.customer_email )
WHERE c.customer_id
IN (
SELECT customer
FROM newsletters_inscriptions
WHERE liste
IN ( 786, 878, 874, 875, 876, 877 )
)
AND c.customer_id NOT
IN (
SELECT customer
FROM newsletters_blacklists
WHERE newsletter =1
)
ORDER BY `l`.`email` ASC
LIMIT 0 , 30
Thanks !