select s1.dept_no,s2.emp_no,s1.maxSalary
 from 
 (select dept_emp.dept_no,max(salary) maxSalary
 from dept_emp left join salaries on dept_emp.emp_no = salaries.emp_no 
 group by dept_emp.dept_no
 order by dept_emp.dept_no asc) s1 
  left join
 (select t1.dept_no,t2.emp_no,t2.salary 
 from dept_emp t1 left join salaries t2 on t1.emp_no = t2.emp_no) s2 
on s1.dept_no = s2.dept_no and s1.maxSalary = s2.salary



构建两张 子表 s1,s2
s1 是每个部门最高工资表
s2 是每个员工的工资表
当 s1的部门号 等于 s2的部门号,且s2的工资等于s1的工资
连接s1 和s2