Mysql - 获取所有部门中当前员工薪水最高的相关信息,给出dept_no, emp_no以及其对应的salary

注意值分别求得所有部门的最高薪资,在结果中用having 进行过滤 

select a.dept_no, a.emp_no, b.salary 
 from dept_emp a, salaries b 
 where a.emp_no = b.emp_no and a.to_date = '9999-01-01' and b.to_date = '9999-01-01'
 group by a.dept_no 
 having max(b.salary);

相关文章:

  • 2021-10-29
  • 2021-11-25
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2021-04-01
猜你喜欢
  • 2021-05-09
  • 2022-12-23
  • 2021-08-21
  • 2022-01-10
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
相关资源
相似解决方案