[ Programing ]/Database

[SQL] 3개 이상의 테이블 조인

Mister_Q 2011. 7. 20. 02:28
n개의 테이블을 조인하려면 최소 n-1개의 조인 조건이 필요

하다.
예를 들어 3개의 테이블을 조인할려면 최소 2개의 조인 조건이 필요 하다.

SELECT e.last_name, d.department_name, l.city
FROM
employees e, departments d, locations l WHERE e.department_id = d.department_id and d.location_id = l.location_id;