select * from Employee as e1 where3 > (selectcount(distinct e2.Salary) from Employee as e2 where e1.Salary < e2.Salary and e1.DepartmentId = e2.DepartmentId)
将 Employee 和 Department 合并
1 2
select d1.Name as Department, e1.Name as Employee, e1.Salary as Salary from Employee as e1, Department as d1 where e1.DepartmentId = d1.Id and3 > (selectcount(distinct e2.Salary) from Employee as e2 where e1.Salary < e2.Salary and e1.DepartmentId = e2.DepartmentId)