# 找到2025年每月的数据 with t1 as ( select id, job, date, num, DATE_FORMAT(date, '%Y-%m') as first_year_mon from resume_info where date between '2025-01-01' and '2025-12-31' ), t2 as ( select job, first_year_mon, sum(num) as first_year_cnt from t1 group by job, first_year_mon order by first_year_mon desc, job desc ), # 找到2026年每月的数据 t3 as ( select id, job, date, num, DATE_FORMAT(date, '%Y-%m') as second_year_mon from resume_info where date between '2026-01-01' and '2026-12-31' ), t4 as ( select job, second_year_mon, sum(num) as second_year_cnt from t3 group by job, second_year_mon order by second_year_mon desc, job desc ) # 将两个数据进行结合变成答案 select t2.job, first_year_mon, first_year_cnt, second_year_mon, second_year_cnt from t2 inner join t4 on t2.job = t4.job and SUBSTRING(t2.first_year_mon, 6, 2) = SUBSTRING(t4.second_year_mon, 6, 2);