sql数据按月统计 每天的数据汇总成一条数据按月显示

2025-03-23 20:20:11
推荐回答(1个)
回答1:

使用case when

case when xx between '2012/12/21' and '2013/1/20' then ’1月‘
...
when xx between '2013/11/21' and '2013/12/20' then ’12月‘
end as 月份

作为子查询,外面group by 一下