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;
标签:求组,内前,前三高,Employee,Department,DepartmentId,Salary,e1,e2 来源: https://www.cnblogs.com/clarencezzh/p/12054151.html