直接按照月份group,然后按照条件求sum select job ,concat('2025-',mon) as first_year_mon ,sum(case when year(date)=2025 then num else 0 end) as first_year_cnt ,concat('2026-',mon) as second_year_mon ,sum(case when year(date)=2026 then num else 0 end) as second_year_cnt from (select id,job,date,...