oracle查询一个表中又另一个表中没有的数据
吹雪 2008-09-14 09:35:45 A表中有telephone字段,caller字段,大概有二万条记录。
B表中有telephone字段。192条记录。
两个表没有建立关联。
B表中是所有telephone的列表(相当于主键)。
A表中是所有的记录,但是记录中的telephone有一部分在B表中有,有一部分没有。现在想查询所有A表中有而B表中没有的telephone字段值列表。
我试过:
select distinct telephone from a where telephone not in(select telephone from b)
这样查不出来,没有一条记录。
select distinct telephone from a where not exists(select 1 from b where a.telephone=b.telephone)
这样在plsql-developer里执行很久也没有返回。