MySQL trigger syntax error on update query -


i'm trying create trigger on mysql using 2 tables. i'm able in database same code adjusted in database giving me syntax error since hours!

create trigger `free_video_used` after update on `user`      each row if new.field = 1 update free_video set free_video.used = 1 free_video.uid = new.uid;  end if; 

as can understand after update on table "user", other table modified field "uid" equal. why isn't working?! thanks!!

try:

delimiter $$  create trigger `free_video_used` after update on `user` each row begin     if (new.field = 1)         update free_video set free_video.used = 1 free_video.uid = new.uid;     end if; end$$  delimiter ; 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -