floor(4.4) 结果为4,浮点转整型
(DATE_FORMAT(PrtTime,‘%H‘) 取小时h
DATE_FORMAT(PrtTime,‘%i‘) 取分钟m
(h*60 + m) /30 取整数部分进行分类汇总
Select result,count(result) as resultTotal,floor((DATE_FORMAT(PrtTime,‘%H‘) *60 + DATE_FORMAT(PrtTime,‘%i‘))/30) as groupHalfHour from degassing_facility_production_data where (prtTime >= ‘2020-01-16‘ and prtTime < ‘2020-01-18‘) group by result,groupHalfHour ;
原文地址:https://www.cnblogs.com/profession/p/12206963.html
时间: 2024-10-13 23:12:02