时间:2021-07-01 10:21:17 帮助过:16人阅读
SHOW VARIABLES LIKE ‘event_scheduler‘;#查看定时器是否开启
SET GLOBAL event_scheduler = 1; # 开启定时器
DROP EVENT
IF EXISTS activity_time_update;
CREATE EVENT activity_time_update ON SCHEDULE EVERY 1 DAY STARTS date_add(
date(curdate() + 1),
INTERVAL 5 SECOND
) ON COMPLETION PRESERVE DO
UPDATE `hnl_user_groups`
LEFT JOIN hnl_goods ON hnl_user_groups.good_id = hnl_goods.id
LEFT JOIN hnl_activity ON hnl_goods.activity_id = hnl_activity.id
SET hnl_user_groups.`status` = 3
WHERE
hnl_activity.endtime < NOW();
mysql 事件
标签:scheduler status add time activity end _id nbsp exists