Reputation: 3
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
Upvotes: 0
Views: 827
Reputation: 12378
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.
Upvotes: 1