题解 | #SQL12 获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
http://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
select tt.dept_no, tt.emp_no, tt.salary from (select dp.*, ss.salary, dense_rank() over(partition by dp.dept_no order by ss.salary desc) as dr from dept_emp dp join salaries ss on dp.emp_no = ss.emp_no where dp.to_date = '9999-01-01') tt where tt.dr = 1