题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
http://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
select d.dept_no,s.emp_no,t.maxSalary
from dept_emp d
join salaries s
on d.emp_no = s.emp_no
join
(select d.dept_no,max(s.salary) maxSalary
from dept_emp d
join salaries s
on d.emp_no = s.emp_no
group by d.dept_no) t
on t.dept_no = d.dept_no and t.maxSalary = s.salary
order by d.dept_no;