简体   繁体   中英

event schedules in maria db

The following query has failed:

CREATE EVENT `UNUSED` 
ON SCHEDULE EVERY 1 HOUR 
STARTS '2016-06-14 11:00:00.000000' ENDS '2016-06-30 01:00:00.000000' 
ON COMPLETION NOT PRESERVE ENABLE DO 
UPDATE quotation_details SET status='UNUSED' WHERE updatedTime <= DATE_SUB(NOW(), INTERVAL 10 DAYS) ;

MySQL said: #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 'DAYS)' at line 1

Change DAYS to DAY like following;)

CREATE EVENT `UNUSED` 
ON SCHEDULE EVERY 1 HOUR 
STARTS '2016-06-14 11:00:00.000000' ENDS '2016-06-30 01:00:00.000000' 
ON COMPLETION NOT PRESERVE ENABLE DO 
UPDATE quotation_details SET status='UNUSED' WHERE updatedTime <= DATE_SUB(NOW(), INTERVAL 10 DAY) ;

And see DATE_SUB function reference here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM