标签:
1、创建存储过程;
CREATE DEFINER=`gzy`@`%` PROCEDURE `delLastMonth`() BEGIN DECLARE lastmonth int; SET lastmonth = DATE_FORMAT(date_sub(curdate(),interval 1 MONTH),‘%Y%m‘); DELETE FROM wysytask.user_sign WHERE `month`=lastmonth; DELETE FROM wysytask.user_resign WHERE `month`=lastmonth; END
2、创建事件;
CREATE DEFINER=`gzy`@`%` EVENT `delLastMonth` ON SCHEDULE EVERY 1 MONTH STARTS ‘2016-08-01 00:00:05‘ ON COMPLETION NOT PRESERVE ENABLE DO CALL delLastMonth
标签:
原文地址:http://www.cnblogs.com/edward1108/p/5738336.html