mdm code 중 사용되지 않는 code 를 뽑아내려 합니다.
예) 테이블 mdm , A, B, C 가 있을때 mdm의 code 가 테이블 A,B,C 모두에서 사용되지 않는 걸 뽑고 싶습니다.
mdm
key | name |
1 | one |
2 | two |
3 | three |
A 테이블
a_key | key |
a1 | 1 |
a2 | 2 |
a3 | 1 |
B 테이블
b_key | key |
b1 | 1 |
b2 | 2 |
C 테이블
c_key | key |
c1 | 1 |
c2 | 2 |
select *
from mdm m
where not exists (selec 'x' from A where a.a_key = m.key and rownum = 1)
and not exists (selec 'x' from A where b.b_key = m.key and rownum = 1)
and not exists (selec 'x' from A where c.c_key = m.key and rownum = 1)
이렇게 했더니 너무 느려서 다른 방법을 찾고 싶어 문의드립니다.
(사용되지 않는 code 3)
A,B,C 의 테이블 의 데이터가 매우 많은 경우입니다.
감사합니다.