sql 查询每天数据

作者: gavin 分类: 未分类 发布时间: 2022-02-19 07:25

date 为时间字段名

account_record为表名
where条件为查询当月数据的条件

SELECT
SUBSTRING(date,1,10) as day,
COUNT(date) as num


FROM
    `account_record`
WHERE
SUBSTRING(date,1,7)=SUBSTRING('2022-02-18',1,7)

GROUP BY
SUBSTRING(date,1,10) ORDER BY date desc;