mysql查询7天内的日期 统计相同时间出现的次数

这个是查询最近7天的数据

这个是sql语句
SELECT create_time FROM table WHERE create_time > (SELECT DATE_ADD(MAX(create_time),INTERVAL -7 DAY) FROM wcs_task) AND TYPE = 'get_box' ORDER BY create_time DESC

img

目前create_time 有3条年月日相同的
4条只有一条的
那么希望查询的信息是根据截取年月日查询或者like查询:



create _time                       count(1)
2021-08-02 03:01:01              2
2021-08-01 01:81:01              1
2021-07-31 01:01:01              2
2021-07-30 01:01:01              2
2021-07-29 01:01:01              1
2021-07-28 01:01:01              1
2021-07-27 01:01:01              1


SELECT create_time,COUNT(1) count 
FROM `table` 
WHERE create_time > (SELECT DATE_ADD(MAX(create_time),INTERVAL -7 DAY) FROM `table`) AND TYPE = 'get_box' 
GROUP BY create_time
ORDER BY create_time DESC

望采纳谢谢。

已实现:
SELECT DATE_FORMAT(create_time,"%Y-%m-%d") AS DAY,COUNT(1) FROM table WHERE create_time > (SELECT DATE_ADD(MAX(create_time),INTERVAL -7 DAY) FROM table) GROUP BY DAY DESC