//1、查询所有年份
//SELECT YEAR (update_time) AS year_all FROM dk_contract GROUP BY YEAR (update_time) ORDER BY YEAR (update_time) ASC
//2、根据年份foreach循环遍历每一年的所有月份聚合所有金额
//SELECT MONTH (update_time) AS month_all, SUM(contract_stage) FROM dk_contract where YEAR(update_time) = 2021 GROUP BY MONTH (update_time) ORDER BY MONTH (update_time)
查询每年每月费用SQL示例
最新推荐文章于 2023-02-23 13:52:20 发布