首页 > 代码库 > MySQL--指定浮点型数据的精确度TRUNCATE

MySQL--指定浮点型数据的精确度TRUNCATE

INSERT INTO perf_week(node_id,perf_time,pm25,pm10,temp,humi)
SELECT node_id,2016-12-08 11:55:00 AS perf_time,TRUNCATE(AVG(pm25),2) AS pm25,TRUNCATE(AVG(pm10),2) AS pm10,
TRUNCATE(AVG(curr_temp),2) AS temp,TRUNCATE(AVG(curr_humidity),2) AS humi FROM perf_pm25 WHERE perf_time BETWEEN DATE_SUB(2016-12-08 11:55:00,INTERVAL 1 WEEK) AND 2016-12-08 11:55:00 GROUP BY node_id;

啦啦啦

MySQL--指定浮点型数据的精确度TRUNCATE