题解 | #实习广场投递简历分析(三)#

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

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

  1. 题目总体不难,但有一点折腾了很久,就是使用date_format函数之后,时间戳格式改变为文本格式了,后面就不能使用year函数,
  2. 对于文本截取有很多函数都可以,当格式比较整齐使用left和right函数最方便, 有时候需要使用regexp_substr之类的函数功能更加强大
with base as 
(select job ,DATE_FORMAT(date,"%Y-%m") as mon,sum(num) as cnt
from resume_info 
group by job,DATE_FORMAT(date,"%Y-%m"))

select b1.job,b1.mon ,b1.cnt,
b2.mon,b2.cnt
from base b1 left join base b2 
on b1.job=b2.job and left(b1.mon,4)+1=left(b2.mon,4)
   and Right(LEFT(b1.mon,7),2)=Right(LEFT(b2.mon,7),2)
having left(b1.mon,4)=2025
order by b1.mon desc,b1.job desc
全部评论

相关推荐

点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务