题解 | #获取每个部门中当前员工薪水最高的相关信息#

获取每个部门中当前员工薪水最高的相关信息

http://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6

select dept_no,
    emp_no ,
    maxSalary
from salaries s
join (
        select dept_no,
            emp_no,
            max(salary) over (partition by dept_no order by dept_no) as maxSalary
        from dept_emp
        left join salaries
        using(emp_no) ) as t1
using(emp_no)
where s.salary=t1.maxSalary
order by dept_no

全部评论

相关推荐

一表renzha:手写数字识别就是一个作业而已
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务