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

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

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

select
  t1.dept_no,
  t1.emp_no,
  t2.maxSalary
from
  (
    select
      de.dept_no,
      de.emp_no,
      s.salary
    from
      dept_emp de,
      salaries s
    where
      de.emp_no = s.emp_no
  ) as t1,
  (
    select
      de.dept_no as dept_no,
      max(salary) as maxSalary
    from
      dept_emp as de,
      salaries as s
    where
      de.emp_no = s.emp_no
    group by
      dept_no
  ) as t2
where
  t1.salary = t2.maxSalary
  and t1.dept_no = t2.dept_no
order by
  dept_no
全部评论

相关推荐

我:“加班需要有加班工资。” hr:“为什么?” 哈哈哈哈哈哈哈离大谱
juntenor:你确实太理想化了,对社会不了解呀。这个和HR没有关系,这是国内特色,不然怎么还会有外包就这种逆天的存在呢。
点赞 评论 收藏
分享
字节一直是我的白月光,考虑到转正还是拒了日常实习。
从今天开始狠狠卷JV...:为什么你释放的offer没流到我头上
点赞 评论 收藏
分享
自由水:笑死了,敢这么面试不敢让别人说
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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