题解 | #查找入职员工时间排名倒数第三的员工所有信息#

查找入职员工时间排名倒数第三的员工所有信息

https://www.nowcoder.com/practice/ec1ca44c62c14ceb990c3c40def1ec6c

hselect
    *
from
    employees
where
    hire_date = (
    select
        distinct hire_date
    from
        employees
    order by
        hire_date desc
    limit 1 offset 2
    )

先通过子查询获得倒数第三的员工入职的日期(先按照日期降序,入职时间一样的员工可能不止一个,通过distinct 关键字进行去重,然后 limit 和 offset的搭配 获得倒数第三的员工入职日期)

最后用where对日期进行筛选

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务