题解 | #获取员工其当前的薪水比其manager当前薪水还高的相关信息#
获取员工其当前的薪水比其manager当前薪水还高的相关信息
http://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef
自用:self join适合employee/manager类型的题
reference:博主:暴打拖拉猪
select de.emp_no as 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 s1.emp_no = de.emp_no
and s2.emp_no = dm.emp_no
and s1.salary > s2.salary
and s1.to_date = "9999-01-01"
and s2.to_date = "9999-01-01"