I would like to delete data in multiple tables, from a trigger but it seem like my syntax is incorrect.
I got the error: "you've got a error in your MySQL syntax please check the manual".
This is the SQL for the trigger:
CREATE TRIGGER `delete_organisation`
BEFORE DELETE ON `organisations`
FOR EACH ROW
DELETE FROM contacts WHERE OLD.id = organisation_id ;
DELETE FROM orders WHERE OLD.id = orders.organisation_id;
DELETE from organisations_products where OLD.id = organisation_id ;
DELETE FROM organisations WHERE OLD.id = organisations.parent ;
Any idea what I'm doing wrong?
on delete cascade
? – a_horse_with_no_name Aug 27 '12 at 7:51