题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
https://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
请教一下各位大佬,这样做有没有漏洞,自己看有点看不出来
select em.dept_no, em.emp_no, sa.salary maxSalary from dept_emp em join salaries sa on em.emp_no =sa.emp_no where (em.dept_no,sa.salary) in ( select em.dept_no,MAX(sa.salary) from dept_emp em join salaries sa on em.emp_no =sa.emp_no group by em.dept_no having em.to_date = '9999-01-01' ) order by em.dept_no