insert into kpidata (create_time, modify_time, applyDate, description, endTime, startTime, value, kpi_id) values (now(), now(), '2017-04-01 00:00:00', '当月报警数环比增长率', now(), now(), -0.10943667025475422, 3001), (now(), now(), '2017-04-01 00:00:00', '当月治安案件数环比增长率', now(), now(), -0.010638297872340425, 3002), (now(), now(), '2017-04-01 00:00:00', '当月刑事案件数环比增长率', now(), now(), -0.02619047619047619, 3003), (now(), now(), '2017-04-01 00:00:00', '当月交通事故数环比增长率', now(), now(), -0.03360392675099113, 3004);
-- 修改日期中的某一部分,比如年份 update criminal_data set applyTime = str_to_date(concat(year(applyTime),'-',month(applyTime),'-01'),'%Y-%m-%d');-- 复制上一年的某月份数据 表【police_call_data】
Insert Into police_call_data(CRIMINAL, ELSECASE, FIRE, MONTH, POLICE, trafficAccident, YEAR, policeStation, applyTime, policeStation_id) select CRIMINAL, ELSECASE, FIRE, 9, POLICE, trafficAccident, 2016, policeStation, '2016-09-01', policeStation_id from police_call_data where applyTime = '2015-09-01 xx:xx:xx';
select * FROM kpidata where (kpi_id=3010 or kpi_id= 3001 or kpi_id=3014 or kpi_id=3002 or kpi_id=3011 or kpi_id=3003 or kpi_id=3004 or kpi_id=3017 or kpi_id=3020 or kpi_id=3021 or kpi_id=3022 or kpi_id=3013 or kpi_id=3005 or kpi_id=3006 or kpi_id=3007 or kpi_id=3008 or kpi_id=3023 or kpi_id=3024 or kpi_id=3019 or kpi_id=3009 or kpi_id=3015 or kpi_id=3016) and `applyDate` > '2016-12-31 21:30:32';
UPDATE `iockpinew`.`police_call_data` SET `FIRE`=NULL WHERE applyTime > '2016-07-30';
select count(p.policeStation_id), p.policeStation_id, d.name from police_call_data p, dict_data d where p.policeStation_id = d.id group by policeStation_id
update criminal_data set applyTime = str_to_date(concat(year(applyTime),'-',month(applyTime),'-01'),'%Y-%m-%d');
MySQL
最新推荐文章于 2022-03-26 22:03:45 发布