题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
http://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
1,先查找出部门ID,最高薪水
2,查找符合条件的记录
select d1.dept_no, d1.emp_no, s1.salary maxSalary from dept_emp d1 inner join salaries s1 on d1.emp_no = s1.emp_no where (d1.dept_no, s1.salary) in (
select de.dept_no, max(s.salary) from dept_emp de inner join salaries s on de.emp_no = s.emp_no group by de.dept_no) order by d1.dept_no