I want to build a query to delete data from 2 tables but wiht some conditions like if the cree_facture.refe ='EST1' delete from cree_devis whith cree_devis.refe='EST1' and if the refe ='INV1' delete from cree_facture with the cree_facture.refe='INV1'
I try with this 2 query bu the problem delete all data from table not has the condition
DELETE FROM `cree_devis`, `cree_facture`
USING `cree_devis`,`cree_facture`
WHERE `cree_devis`.`cree_par` = `cree_facture`.`cree_par`
AND (`cree_devis`.`refe` = 'INV1' OR `cree_facture`.`refe` = 'INV1' )
and
DELETE cree_devis, cree_facture
FROM cree_devis
INNER JOIN cree_facture ON (cree_devis.cree_par=cree_facture.cree_par)
WHERE cree_devis.refe = 'EST1'
OR cree_facture.refe = 'EST1';