mysql 차집합 구하기
2008. 8. 25. 15:15 |
### 프로그래밍/mysql
a-b 차집합 구하기
select tableA.id, tableA.name from tableA LEFT JOIN tableB ON table A.id=tableB.id WHERE tableB.id IS NULL;
b-a 차집합 구하기
select tableA.id, tableA.name from tableA LEFT JOIN tableB ON table A.id=tableB.id WHERE tableA.id IS NULL;
* 참고 흔히 행하는 잘못된 쿼리
select tableA.id, tableA.name from tableA LEFT JOIN tableB ON tableA.id=tableB.id WHERE tableB.id IS NULL;