概述
我试图创建一个触发器来更新另一个条件检查表,但我不断收到一个MySQL错误。我的触发器的代码是:
DELIMITER $$
CREATEb
TRIGGER visitor_validation
BEFORE INSERT ON ratingsvisitors
FOR EACH ROW
BEGIN
Set @counts=(SELECT count(*) from ratingsvisitors where visotrid=new.userid AND profileid=New.profileid AND itemid=New.itemid AND likevalidation=New.likevalidation AND likesordislike=New.likesordislike);
SET @ifexists = (SELECT * FROM ratingcounttracks WHERE userid=New.userid AND likedate=New.likevalidation AND countfor=New.likesordislike);
IF (@ifexists = NULL) THEN
INSERT INTO ratingsvisitors(userid, likedate, clickcount,countfor) values (New.userid, New.likevalidation ,'1',New.likesordislike);
ELSE
UPDATE ratingsvisitors SET clickcount=clickcount+1 WHERE userid=New.userid AND likedate=New.likevalidation AND countfor=New.likesordislike;
ENDIF;
END$$MySQL显示错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; END' at line 12
最后
以上就是苹果电灯胆为你收集整理的mysql触发器 多个条件_当条件为真时,如何使用MySQL触发器更新多个表?的全部内容,希望文章能够帮你解决mysql触发器 多个条件_当条件为真时,如何使用MySQL触发器更新多个表?所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复