思路

实习广场投递简历分析(三)

http://www.nowcoder.com/questionTerminal/83f84aa5c32b4cf5a75558d02dd7743c

思路分享:
首先查找2026年的简历投递情况->查找2025年的简历投递情况->上述两查询结果以job和月份进行内联结->从内联结表中获取所有信息
step1-2: 查找2026/2025年的简历投递情况:

select job,date,date_format(date,'%Y-%m') as second_year_mon,sum(num) as second_year_cnt
from resume_info 
where date like '2026%'
group by job,second_year_mon 

step2:上述两查询结果以job和月份进行内联结

(
    select job,date,date_format(date,'%Y-%m') as second_year_mon,sum(num) as second_year_cnt
    from resume_info 
    where date like '2026%'
    group by job,second_year_mon 
)as tmp2
inner join 
(
    select job,date,date_format(date,'%Y-%m') as second_year_mon,sum(num) as second_year_cnt
    from resume_info 
    where date like '2025%'
    group by job,second_year_mon 
) as tmp
on  tmp.job = tmp2.job and date_format(tmp.date,'%m') =  date_format(tmp2.date,'%m') 

step3:查询最终结果

select tmp.job,first_year_mon,first_year_cnt,second_year_mon ,second_year_cnt 
(
    select job,date,date_format(date,'%Y-%m') as second_year_mon,sum(num) as second_year_cnt
    from resume_info 
    where date like '2026%'
    group by job,second_year_mon 
)as tmp2
inner join 
(
    select job,date,date_format(date,'%Y-%m') as second_year_mon,sum(num) as second_year_cnt
    from resume_info 
    where date like '2025%'
    group by job,second_year_mon 
) as tmp
on  tmp.job = tmp2.job and date_format(tmp.date,'%m') =  date_format(tmp2.date,'%m') 
order by tmp.first_year_mon DESC,tmp.job DESC
全部评论
这样不对把
点赞 回复 分享
发布于 2021-08-22 14:56
运行不出答案
点赞 回复 分享
发布于 2021-09-23 11:31

相关推荐

不愿透露姓名的神秘牛友
11-24 20:55
阿里国际 Java工程师 2.7k*16.0
程序员猪皮:没有超过3k的,不太好选。春招再看看
点赞 评论 收藏
分享
点赞 评论 收藏
分享
2 收藏 评论
分享
牛客网
牛客企业服务