I want to update two tables before insert into table table1, in phpmyadmin, but phpmyadmin displays error after creating this trigger (Error in MySQL syntax).
This works:
CREATE TRIGGER `my_trig`
BEFORE INSERT ON `table1`
FOR EACH ROW
update table2
set
attr = attr+NEW.attr
where table2.id = NEW.id;
This works too (without the first trigger, of course):
CREATE TRIGGER `my_trig`
BEFORE INSERT ON `table1`
FOR EACH ROW
update table3
set
attr = attr+NEW.attr
where table3.id = NEW.id;
But using BEGIN- update1; update2; -END it can´t be created. Any ideas how to create this type of trigger? Thanks in advance for your help.
you have extra comma after the set statement
fix,
using
BEGIN-END