通过(一) https://blog.nowcoder.net/n/9cea00e9be1a4b62934ca65067a0c9b7 ,我们可以写出:
select job,sum(num) as cnt from resume_info where date >'2025-01-01' and date <'2025-12-31' group by job order by cnt desc;
该题其实就是加了一个日期聚合,但是这个日期函数聚合是通过月聚合的,所以我们要使用Mysql里面的DATE_FORMAT函数,来获取月份,然后我们写出:
select job,DATE_FORMAT(date, '%Y-%m') as mon,sum(num) as cnt from resume_info where date >'2025-01-01' and date <'2025-12-31' group by job,mon order by mon desc, cnt desc ;就可以达到题目的目的