使用子表查询,格式清除,简单易懂
select b.emp_no as emp_no,a.emp_no as manger_no, b.salary as emp_salary,a.salary as manger_salary from ( select dd.emp_no,dd.dept_no,s.salary from dept_manager dd,salaries as s where dd.emp_no=s.emp_no )as a, ( select d.emp_no,d.dept_no,s.salary from dept_emp d,salaries s where d.emp_no=s.emp_no )as b where a.dept_no=b.dept_no and a.emp_no<>b.emp_no and a.salary<b.salary;