一、参考资料
MySQL 基于存储过程 实现数据统计按日、周、月份统计模板
按周查询
select DATE_FORMAT(commit_time, '%x年-第%v周') as months, sum(a.rmb) / 100 as rmb
from t_cashout as a
where a.commit_time >= '2021-01-01 00:00:00' group by months order by months desc;
按周查询
select DATE_FORMAT(commit_time, '%x年-第%v周') as months, sum(a.rmb) / 100 as rmb
from t_cashout as a
where a.commit_time >= '2021-01-01 00:00:00' group by months order by months desc;