Leetcode 185. 部门工资前三高的所有员工(查同组前几 经典嵌套子查询)

2021-04-01 17:07:17 浏览数 (1)

代码语言:javascript复制
select d.name "Department",e.name "Employee",Salary
    from Employee e join Department d
    on e.Departmentid=d.id
    where 
    (select count(distinct(e1.salary)) 
    from Employee e1
    where e.salary<e1.salary
    and e.Departmentid=e1.Departmentid)
    <3

0 人点赞