1

Do you guys have any idea of how to do this in Mysql?? to Create only one event without using 'IF' that happens how many days i want forever? Ex: an Event that happens every mondey, friday and sunday!

matmany
  • 151
  • 1
  • 6

1 Answers1

0

There doesn't seem to be any syntax for what you're describing.

If I had to do this with a MySQL EVENT, I'd implement this with an IF for the day of week (MySQL uses Sunday=1).

CREATE EVENT MyEvent
 ON SCHEDULE EVERY 1 DAY
DO BEGIN
  IF DAYOFWEEK(CURDATE()) IN (1, 2, 6) THEN
    ...whatever you want...
  END IF
END

But practically speaking, I don't use MySQL EVENTs. I use cron. Then one can specify to run on the three days of the week you want (cron uses Sunday=0):

0 0 * * 0,1,5 myscript.sh
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828