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

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

http://www.nowcoder.com/questionTerminal/f858d74a030e48da8e0f69e21be63bef

select t2.emp_no, t2.manager_no, t2.emp_salary, salaries.salary as manager_salary from

(select t1.emp_no as emp_no, dept_manager.emp_no as manager_no, salaries.salary as emp_salary

from

(select emp_no, dept_no
from dept_emp
where to_date = '9999-01-01') as t1

left join dept_manager on dept_manager.dept_no = t1.dept_no

left join (select * from salaries where to_date='9999-01-01') as salaries on salaries.emp_no = t1.emp_no) as t2

left join (select * from salaries where to_date='9999-01-01') as salaries on salaries.emp_no = t2.manager_no

where manager_salary < emp_salary

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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