SELECT CONCAT(YEAR(DATE), if (MONTH(DATE)<10,CONCAT('0',MONTH(DATE)),MONTH(DATE))) AS date , round(SUM(capacity),2) AS ca_dsoc FROM dianchi4 where date > '20211231' GROUP BY YEAR(DATE), MONTH(DATE)
月度的跨年处理就是第一个
SELECT CONCAT(YEAR(DATE), if (MONTH(DATE)<10,CONCAT('0',MONTH(DATE)),MONTH(DATE))) AS date , round(SUM(capacity),2) AS ca_dsoc FROM dianchi4 where date > '20211231' GROUP BY YEAR(DATE), MONTH(DATE)
月度的跨年处理就是第一个