方法一:

with t_2025 as (
select job,date_format(date,'%Y-%m') as month,sum(num) as sum
from resume_info
where year(date)=2025
group by month,job
),
 t_2026 as (
select job,date_format(date,'%Y-%m') as month,sum(num) as sum
from resume_info
where year(date)=2026
group by month,job
)

select 
t_2025.job,
t_2025.month as first_year_mon,
t_2025.sum as first_year_cnt,
t_2026.month as second_year_mon,
t_2026.sum as second_year_cnt
from
t_2025 inner join 
t_2026
on t_2025.job=t_2026.job
and 
right(t_2025.month,2)=right(t_2026.month,2)
order by first_year_mon desc,t_2025.job desc

方法二: