I have the following event_scheduler-
CREATE EVENT my_schedule
ON SCHEDULE EVERY 1 MINUTE
STARTS CURRENT_TIMESTAMP
ENDS CURRENT_TIMESTAMP + INTERVAL 40 DAY
DO
BEGIN
-----
END
It works fine. But now I would like to add another event which will run from 12:01AM to 02:00AM each day with 1 minute interval. Something like -
CREATE EVENT new_schedule
ON SCHEDULE EVERY 1 MINUTE
STARTS 12:01AM
ENDS 02:00AM
DO
BEGIN
------
END
I'm new to MySQL event_scheduler. Please share your idea.
You can use if statement to check the timestamp before running within the specified interval
CREATE EVENT new_schedule
ON SCHEDULE EVERY 1 MINUTE
STARTS CURRENT_TIMESTAMP
ENDS CURRENT_TIMESTAMP + INTERVAL 40 DAY
DO
IF time(CURRENT_TIMESTAMP) between time('00:00:00') and time('02:00:00')
then
-----
end if;