你的sql语法有错误;

hfwmuf9z  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(303)

错误:
检查与您的mariadb服务器版本相对应的手册,以便在第5行的“end”附近使用正确的语法

CREATE DEFINER=`root`@`localhost` EVENT `start_game` ON SCHEDULE EVERY 3 MINUTE STARTS '2018-05-05 05:50:07' ON COMPLETION PRESERVE DISABLE DO BEGIN
set @game_id = (select id FROM tbl_game where game_status=0 ORDER BY id ASC LIMIT 1);

update tbl_game set game_status = 1 where id = @game_id;
END
mitkmikd

mitkmikd1#

使用 DELIMITER 批处理之前和结束。

DELIMITER $$
CREATE DEFINER=root@localhost EVENT start_game ON SCHEDULE EVERY 3 MINUTE STARTS '2018-05-05 05:50:07' ON COMPLETION PRESERVE DISABLE DO BEGIN set @game_id = (select id FROM tbl_game where game_status=0 ORDER BY id ASC LIMIT 1);

update tbl_game set game_status = 1 where id = @game_id; 
END $$
DELIMITER ;

相关问题