185. 部门工资前三高的所有员工(求组内前几的值)
求每个部门工资前三的员工
参考链接:https://leetcode-cn.com/problems/department-top-three-salaries/solution/185-bu-men-gong-zi-qian-san-gao-de-yuan-gong-by-li/
SELECT Department.NAME AS Department, e1.NAME AS Employee, e1.Salary AS Salary FROM Employee AS e1,Department WHERE e1.DepartmentId = Department.Id AND 3 > (SELECT count( DISTINCT e2.Salary ) FROM Employee AS e2 WHERE e1.Salary < e2.Salary AND e1.DepartmentId = e2.DepartmentId ) ORDER BY Department.NAME,Salary DESC;
加油啦!加油鸭,冲鸭!!!