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

mysql event

时间:2017-06-08 14:55:51      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:min   order   enable   rate   int   end   ever   bsp   sdn   

推荐看:

http://blog.csdn.net/jesseyoung/article/details/35257527

 

SET GLOBAL event_scheduler = ON;

drop procedure if exists p_insmrgnrate_update;
create PROCEDURE p_insmrgnrate_update()
BEGIN
DECLARE count_num INT DEFAULT 0;
SET SQL_SAFE_UPDATES = 0;

update t_insmrgnrate set tradingday=date_add(CURDATE(), interval 1 day)+0 where tradingday=
(SELECT a.tradingday FROM (SELECT tradingday from t_insmrgnrate GROUP BY tradingday ORDER BY tradingday desc LIMIT 0,1) a);

update t_insmrgnrate set tradingday=CURDATE()+0 where tradingday=
(SELECT a.tradingday FROM (SELECT tradingday from t_insmrgnrate GROUP BY tradingday ORDER BY tradingday desc LIMIT 1,1) a);

update t_insmrgnrate set tradingday=date_sub(CURDATE(), interval 1 day)+0 where tradingday=
(SELECT a.tradingday FROM (SELECT tradingday from t_insmrgnrate GROUP BY tradingday ORDER BY tradingday desc LIMIT 2,1) a);

END;


DROP EVENT IF EXISTS event_insmrgnrate_update;
create EVENT event_insmrgnrate_update
ON SCHEDULE EVERY 1 MINUTE STARTS ‘2017-06-08 08:00:00‘
ON COMPLETION PRESERVE
ENABLE
DO
call p_insmrgnrate_update;

mysql event

标签:min   order   enable   rate   int   end   ever   bsp   sdn   

原文地址:http://www.cnblogs.com/kaishan1990/p/6962574.html

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