题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
https://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
with t as( select emp_no, dept_no, salary, max(salary) over(partition by dept_no) as group_max from dept_emp left join salaries using(emp_no) ) select dept_no, emp_no, salary as maxSalary from t where salary=group_max
构造一列每各部门的最大工资,再对比选出与最大工资相等的员工信息。