MySQL在活动安排上

时间:2015-09-27 13:30:03

标签: mysql database triggers syntax-error

我收到以下错误:

  

您的SQL语法有错误;检查手册   对应于您的MySQL服务器版本,以便使用正确的语法   在第7行'END'附近

DELIMITER$$
CREATE EVENT myevs
ON SCHEDULE EVERY 1 DAY

DO 
 BEGIN
   INSERT INTO ww SELECT * FROM fff WHERE dates = NOW()
   DELETE FROM fff where dates = NOW()
END$$

DELIMITER;

1 个答案:

答案 0 :(得分:1)

您在;insert声明的末尾遗漏了分号(delete):

DELIMITER$$
CREATE EVENT myevs
ON SCHEDULE EVERY 1 DAY

DO 
 BEGIN
   INSERT INTO ww SELECT * FROM fff WHERE dates = NOW();
   -- Here --------------------------------------------^

   DELETE FROM fff where dates = NOW();
   -- And here -----------------------^
END$$

DELIMITER;