MySQL Event Scheduler on a specific time everyday

gin picture gin · Jun 18, 2010 · Viewed 117k times · Source

Here's my query

CREATE EVENT
RESET ON SCHEDULE AT TIMESTAMP DO
UPDATE `ndic`.`students`
SET `status` = '0';  

How can I update status to "0" at 1 pm every day.

What can I use instead of TIMESTAMP?

Answer

user3155099 picture user3155099 · Jan 2, 2014

This might be too late for your work, but here is how I did it. I want something run everyday at 1AM - I believe this is similar to what you are doing. Here is how I did it:

CREATE EVENT event_name
  ON SCHEDULE
    EVERY 1 DAY
    STARTS (TIMESTAMP(CURRENT_DATE) + INTERVAL 1 DAY + INTERVAL 1 HOUR)
  DO
    # Your awesome query