方法)两表联结 且 员工不为manager
SELECT de.emp_no, dm.emp_no FROM dept_emp AS de LEFT JOIN dept_manager AS dm ON de.dept_no = dm.dept_no WHERE dm.to_date = '9999-01-01' AND de.emp_no NOT IN ( -- 员工不为manager SELECT emp_no FROM dept_manager);
SELECT de.emp_no, dm.emp_no FROM dept_emp AS de LEFT JOIN dept_manager AS dm ON de.dept_no = dm.dept_no WHERE dm.to_date = '9999-01-01' AND de.emp_no NOT IN ( -- 员工不为manager SELECT emp_no FROM dept_manager);