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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -