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

以下代码数据库中能通过,但是在牛客上运行无法通过,我看运行出来的结果是一致的

select

dept_emp.dept_no,

dept_emp.emp_no,

salaries.salary as maxSalary

from dept_emp

inner join salaries

on dept_emp.emp_no = salaries.emp_no

where (dept_emp.dept_no,salaries.salary) in(

select

distinct dept_emp.dept_no,

max(salaries.salary)

from salaries left join dept_emp on salaries.emp_no = dept_emp.emp_no

group by dept_emp.dept_no

)

group by dept_emp.emp_no

order by salaries.salary

;

全部评论

相关推荐

用微笑面对困难:985只有在应届生里面的优势是断层的在社招或者更远的工作中算是后续能力优先级
工作压力大,你会干什么?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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