本文主要是介绍三表连接查询,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
例1:
select e.last_name,e.first_name,d.dept_name
from employees as e
left join dept_emp as de on e.emp_no=de.emp_no
left join departments as d on de.dept_no=d.dept_no;
例2:
select dept_emp.dept_no,employees.emp_no,salary
from employees
left join dept_emp
on employees.emp_no=dept_emp.emp_no
left join salaries
on employees.emp_no=salaries.emp_no
WHERE dept_emp.to_date='9999-01-01'
AND salaries.to_date='9999-01-01'
and employees.emp_no not in(select emp_no from dept_managerWHERE to_date='9999-01-01');
这篇关于三表连接查询的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!