题解 | #实习广场投递简历分析(三)#
实习广场投递简历分析(三)
http://www.nowcoder.com/practice/83f84aa5c32b4cf5a75558d02dd7743c
select t.job,t.mon first_year_mon,t.cnt first_year_cnt,n.mon second_year_mon,n.cnt second_year_cnt
from (select job,DATE_FORMAT(date,'%Y-%m') mon,sum(num) cnt
from resume_info
where year(date) = '2025'
group by job,mon) t
join (select job,DATE_FORMAT(date,'%Y-%m') mon,sum(num) cnt
from resume_info
where year(date) = '2026'
group by job,mon) n
on t.job = n.job and right(t.mon,2) = right(n.mon,2)
order by first_year_mon desc,t.job desc;
上述代码是通过了,但是连接条件里,为什么用month(t.mon) = month(n.mon)不行呢,求大神解答,感激不尽~