前两天做一张报表,里边涉及历史数据清洗,所以记录下,以便以后直接用。
DELIMITER $$
USE `TopJet560Report`$$
DROP PROCEDURE IF EXISTS `pr_date`$$
CREATE DEFINER=`root`@`%` PROCEDURE `pr_date`(IN beginDate DATETIME,IN endDate DATETIME)
BEGIN
DECLARE nowdate DATETIME DEFAULT NOW();
DECLARE zhongjiandate DATETIME DEFAULT NOW();
DECLARE endtmp DATETIME DEFAULT NOW();
SET nowdate = DATE_FORMAT(beginDate,'%Y-%m-%d 00:00:00');
SET endtmp = DATE_FORMAT(endDate,'%Y-%m-%d 00:00:00');
WHILE nowdate<endtmp
DO
CALL pr_bonus_statistics_updatev2(nowdate);
SET nowdate = DATE_ADD(nowdate,INTERVAL 1 DAY);
-- set nowdate=nowdate+' 00:00:00';
END WHILE;
END$$
DELIMITER ;