Mysql event scheduler is like this :
CREATE EVENT update_status
ON SCHEDULE EVERY 2 MINUTE
DO
BEGIN
UPDATE customer_group
SET is_status = 0
WHERE CURRENT_TIMESTAMP BETWEEN start_date AND end_date;
UPDATE customer_group
SET is_status = 1
WHERE CURRENT_TIMESTAMP NOT BETWEEN start_date AND end_date;
END
Error Code: 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 7
I cannot spot the error , try this :
DELIMITER $$
CREATE EVENT update_status
ON SCHEDULE
EVERY 2 MINUTE
DO
BEGIN
UPDATE
customer_group
SET
is_status = 0
WHERE
CURRENT_TIMESTAMP BETWEEN start_date AND end_date;
UPDATE
customer_group
SET
is_status = 1
WHERE
CURRENT_TIMESTAMP NOT BETWEEN start_date AND end_date;
END $$
DELIMITER ;