使用中间过程的结果

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

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

select d1.dept_no, d1.emp_no, s1.salary as maxSalary
from dept_emp d1
left join salaries s1
on d1.emp_no=s1.emp_no,
(select d.dept_no, max(s.salary) as maxSalary
from dept_emp d
left join salaries s
on d.emp_no=s.emp_no
group by d.dept_no) as maxSalaryTable
where s1.salary = maxSalaryTable.maxSalary
and d1.dept_no = maxSalaryTable.dept_no
order by d1.dept_no; 

ww

全部评论
看我个签
点赞 回复 分享
发布于 2022-04-09 22:54

相关推荐

07-07 17:06
已编辑
深圳技术大学 golang
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

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