0

以下の2つのテーブルがあります。Oracle10gを使用しています

TableA
---------
id  Name
--- ----
1   abc
2   def
3   xxx
4   yyy

TableB
---------
id  Name
--- ----
1   abc
2   def

TableC
---------
id  Name
--- ----
1   abc
2   def

今私はIDを取得する必要がありますfrom TableA which are not there in TableB and TableC。NOT IN句を使用せずにこれを行うにはどうすればよいですか?

私を助けてください!

ありがとう!

4

4 に答える 4

2

してみてください:

SELECT 
  a.ID, 
  a.NAME
FROM 
  TABLEA a LEFT JOIN TABLEB b ON a.ID=b.ID 
    LEFT JOIN TABLEC c ON a.ID=c.ID
WHERE 
  b.ID IS NULL AND 
  c.ID IS NULL;
于 2013-03-08T10:58:12.340 に答える
1
select * from TableA
minus
select * from TableB

編集 :

BとCに同時に存在しないもの:

select * from TableA
minus (
  select * from TableB
  intersect
  select * from TableC
)

BまたはCにないもの:

select * from TableA
minus 
select * from TableB
minus
select * from TableC
于 2013-03-08T10:56:21.987 に答える
0
select a.id
from tableA a,tableB b,tableC c
where a.id != b.id and a.id!=c.id 

これでいいですか?

于 2013-03-08T11:21:05.343 に答える
0
select * from TableA
minus
(select * from TableB
union
select * from TableC)
于 2013-03-08T11:22:39.853 に答える