/* 重新统计天汇总数据 1、清理指定日期的每小时数据; 2、重新统计该日期的每小时数据; 3、清理该日统计数据; 4、重新统计该日统计数据; 如:重新统计2021-07-13日数据,则传入 '2021-07-13' call proc_reset_taxi_data('2021-07-13'); */ -- ------------------------------------- DELIMITER // DROP PROCEDURE IF EXISTS `proc_reset_taxi_data`; CREATE PROCEDURE `proc_reset_taxi_data`(in time_day varchar(40)) BEGIN DECLARE day_start_ datetime DEFAULT concat(time_day,' 00:00:00'); DECLARE reset_hour_start_ datetime DEFAULT concat(time_day,' 00:00:00'); DECLARE reset_hour_end_ datetime DEFAULT DATE_ADD(reset_hour_start_,INTERVAL 1 HOUR); DECLARE day_end_ datetime DEFAULT DATE_ADD(reset_hour_start_,INTERVAL 1 DAY); select day_start_,day_end_,reset_hour_start_,reset_hour_end_; # 更新gid_100字段 select * from taxi_realtimedata order by posttime desc limit 100; update taxi_realtimedata set gid_100=CONCAT(LEFT(LON_BAIDU,7),'_',LEFT(LAT_BAIDU,6)) where gid_100 is null and posttime>=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=reset_hour_start_ and posttime=reset_hour_start_ and posttime=reset_hour_start_ and posttime=reset_hour_start_ and posttime=reset_hour_start_ and posttime=reset_hour_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime=day_start_ and posttime