mysql自定义时间段分组
说明:一下是自定义7天为一个时间段的分组统计
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
select datediff(ms_time, '开始时间') div 7 as time , count(*) count,sum(money) money
from merchant_statistics
WHERE ms_time BETWEEN '2019-02-02' and '2019-03-02'
group by (datediff(ms_time, '开始时间') div 7)

更多精彩