创建两个表再连接
获取每个部门中当前员工薪水最高的相关信息
http://www.nowcoder.com/questionTerminal/4a052e3e1df5435880d4353eb18a91c6
创建表1:员工-部门-薪资表
表2:部门-部门最高薪资表
再根据部门连接两个表即可
select a.dept_no, a.emp_no, b.maxSalary from (select a.emp_no, a.dept_no, b.salary from dept_emp as a inner join salaries as b on a.emp_no = b.emp_no ) as a inner join (select dept_no, max(salary) as maxSalary from dept_emp as a inner join salaries as b on a.emp_no = b.emp_no group by dept_no ) as b on a.dept_no = b.dept_no and a.salary = b.maxSalary order by a.dept_no