题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
https://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
select dept_no ,emp_no ,round(avg(maxSalary),0) maxSalary from ( select dept_no ,first_value(dept_emp.emp_no)over(partition by dept_no order by salary desc) emp_no ,max(salary)over(partition by dept_no) maxSalary from dept_emp left join salaries on dept_emp.emp_no = salaries.emp_no ) a group by 1,2 order by 1