题解 | #获取员工其当前的薪水比其manag

获取员工其当前的薪水比其manager当前薪水还高的相关信息

https://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef

select
e.emp_no   as emp_no
,m1.emp_no as manager_no
,s1.salary as emp_salary
,s2.salary as manager_salary
from dept_emp e left join salaries s1
on e.emp_no=s1.emp_no #全体员工工资列
left join dept_manager m1
on e.dept_no =m1.dept_no  #经理列
left join salaries s2
on m1.emp_no=s2.emp_no #经理工资列
where e.to_date='9999-01-01'
and s1.salary>s2.salary #当前薪水比其manager薪水还高

因为必须要列出经理工资和经理工号,所以必须加上几列,给员工附上更多的信息,就是其对应的经理工号和工资

全部评论

相关推荐

现在才开始投还有可能吗😭😭😭
牛客621925249号:开秋招了已经
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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