Leetcode 185: Department Top Three Salaries

题目:
Leetcode 185: Department Top Three Salaries
代码:

SELECT d.Name as 'Department', e1.Name as 'Employee', e1.Salary
FROM Employee e1 INNER JOIN Department d
        ON e1.DepartmentId = d.Id
WHERE 3 >= (
    SELECT COUNT(DISTINCT e2.Salary)
    FROM Employee e2
    WHERE e2.Salary >= e1.Salary AND e2.DepartmentId = d.Id
)
ORDER By d.Name, e1.Salary DESC

结果如下:
Leetcode 185: Department Top Three Salaries
如果有其他办法,请留言告诉我把~
觉得不错,就点赞或者关注~ ~
谢谢~

上一篇:#每日一读 根据给定的函数对列表的元素进行分组


下一篇:[leetcode/lintcode 题解] 字节跳动面试题:换硬币