思路:本题主要考察函数的使用与两表连接,year函数可以取出date中的年份,month函数可以取出date中的月份。

但有一点需要注意,month不能取出经过data_formart函数格式化后的月份,如:month(date_format(date, '%Y-%m'))这种是不行的。

本题主要通过month取出月份,用月份进行分组和等值比较,其他的与实习广场投递简历分析(二)相差不多

select t1.job, date_format(t1.date, '%Y-%m') as first_year_mon, t1.cnt as first_year_cnt, date_format(t2.date, '%Y-%m') as second_year_mon, t2.cnt as second_year_cnt
from (select job, date, sum(num) as cnt
			from resume_info
			where year(date) = '2025'
			group by month(date), job
			) as t1 
join (select job, date, sum(num) as cnt
			from resume_info
			where year(date) = '2026'
			group by month(date), job
			) as t2
on t1.job = t2.job
and month(t1.date) = month(t2.date)
order by first_year_mon desc, job desc