--Function--Set the time zone set time_zone = ' ";--turn on event Scheduler set GLOBAL Event_scheduler = 1; Drop event if exists commission_zjdj_a_every_hours; # set delimiter to ' $$ ' DELIMITER $$ Create event commission_zjdj_a_every_hours on schedule every 1 HOUR starts ' 2018-06-24 23:59: The "DO Begin" Call Proc_zjdj_a_commission (); End $$ # Sets the statement separator back to '; ' DELIMITER; --Process # # # #获取当天有效的资金对接A岗一次打包数据, keep a drop PROCEDURE IF EXISTS proc_zjdj_a_commission on the day; CREATE PROCEDURE proc_zjdj_a_commission () Begindeletefromreport_statistics_commission_inquirywheretype = 2AND Date_ Format (count_time, '%y-%m ') = Date_format (now (), '%y-%m '), #一次打包-to-money docking A-gang insert INTO ' report_statistics_commission _inquiry ' (' user_id ', ' order_code ', ' execute_time ', ' task_code ', ' count_time ', ' type ', ' ext1 ', ' ext2 ', ' ext3 ') Selectreceive_id,order_code,finish_time, Task_code,now (), 2,null,null,nullfrommy_taskwhere ' status ' = 2AND Task_code = ' t_ycdb_0004 ' #排除重复订单AND order_code not in (Selectorder_codefromreport_statistics_commission_inquirywheretype = 2) GROUP by order_code; END;
mysql--Timer function + Process Demo