I'm trying to create an event for MySQL which should change some values when the date (Datum) is less than today. I used the CURDATE() format because that works best for me.
CREATE EVENT `test_event_date`
ON SCHEDULE EVERY 1 MINUTE
DO BEGIN
UPDATE users
SET Subbed='Yes', Datum=''
WHERE Datum < CURDATE();
END;
I set it to 1 minute just for test purposes ;)
But when i try this it gives me the following error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6
But iv'e checked it multiple times, and tried values without '' and i tried CURDATE() with '', but nothing seems to work.
Please help :c
It works now!
I needed the DELIMITER //
to get it to work
DELIMITER //
CREATE EVENT `test_eventdate`
ON SCHEDULE EVERY 1 MINUTE
DO BEGIN
UPDATE users
SET Subbed='Yes', Datum=''
WHERE Datum < CURDATE();
END;
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.