数据库
首页 > 数据库> > 牛客SQL25--获取员工其当前的薪水比其manager当前薪水还高的相关信息

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

作者:互联网

MYSQL:

select de.emp_no,dm.emp_no as manager_no,
s1.salary as emp_salary,s2.salary as manager_salary
from dept_emp de,dept_manager dm,salaries s1,salaries s2
where de.dept_no=dm.dept_no
and de.emp_no=s1.emp_no
and dm.emp_no=s2.emp_no
and s1.salary>s2.salary
and s2.to_date='9999-01-01'
and s1.to_date='9999-01-01';

 

标签:salary,no,薪水,s2,s1,比其,--,manager,emp
来源: https://www.cnblogs.com/asenyang/p/15400424.html