使用中间过程的结果
获取每个部门中当前员工薪水最高的相关信息
http://www.nowcoder.com/questionTerminal/4a052e3e1df5435880d4353eb18a91c6
select d1.dept_no, d1.emp_no, s1.salary as maxSalary from dept_emp d1 left join salaries s1 on d1.emp_no=s1.emp_no, (select d.dept_no, max(s.salary) as maxSalary from dept_emp d left join salaries s on d.emp_no=s.emp_no group by d.dept_no) as maxSalaryTable where s1.salary = maxSalaryTable.maxSalary and d1.dept_no = maxSalaryTable.dept_no order by d1.dept_no;
ww