按照分钟进行统计:
DATE_FORMAT(create_time, '%Y-%m-%d %H:%i')
按照小时进行统计:
DATE_FORMAT(create_time, '%Y-%m-%d %H')
按照天数进行统计:
DATE_FORMAT(create_time, '%Y-%m-%d')
按照月份进行统计:
DATE_FORMAT(create_time, '%Y-%m-%d')
按照分钟进行统计:DATE_FORMAT(create_time, '%Y-%m-%d %H:%i') 按照小时进行统计:DATE_FORMAT(create_time, '%Y-%m-%d %H') 按照天数进行统计:DATE_FORMAT(create_time, '%Y-%m-%d') 按照月份进行统计:DATE_FORMAT(create_time, '%Y-%m-%d')
SELECT
DATE_FORMAT(create_time, '%Y-%m') createTimeByMin, source,count(1) AS orderCount
FROM xxx.tablename where biz_code='555'
AND create_time < '2020-11-07' AND create_time BETWEEN '2020-11-06 13:00:00' AND '2020-11-06 18:31:59'
GROUP BY createTimeByMin,source;