码迷,mamicode.com
首页 > 数据库 > 详细

mysql 事件

时间:2017-05-05 14:16:42      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:scheduler   status   add   time   activity   end   _id   nbsp   exists   

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   

原文地址:http://www.cnblogs.com/lmaster/p/6812525.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!