CREATE EVENT update_status
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE
ON COMPLETION PRESERVE
DO BEGIN
UPDATE OnDuty SET Status = '10-7' WHERE minute(timediff(Date,CURRENT_TIMESTAMP)) < 30;
END;
似乎无法正常工作,在PHPMyAdmin中,它给了我这个错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 7
我迷路了。我不习惯在MariaDB中执行计划。
答案 0 :(得分:0)
让脚本正常工作,但是现在看来它不会更新行...
CREATE EVENT `update_status`
ON SCHEDULE EVERY 1 MINUTE
ON COMPLETION NOT PRESERVE ENABLE DO
UPDATE OnDuty SET Status = '10-7' WHERE Date < CURRENT_TIMESTAMP AND Status NOT IN('10-5','10-7','Code 0');