oracle not exists 的问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 13:16:45
select id
from entity
where etype in ('D')
and parent_id = 83
and not exists (select id from lbs_person)

我想查出 entity 表的id 但是要这个id不在lbs_person 表的 也就是过滤部分id 不过我这样写PL报错了 请问该怎么写才对呢
not in 的效率太低了 不想用not in 请问就用这个 exists 该怎么写呢

select id
from entity
where etype in ('D')
and parent_id = 83
and id not in (select id from lbs_person)

嘿嘿,既然not in效率低,那么上边你也别用etype in ('D') 了,一个道理,不如etype='D'了

select id
from entity
where etype in ('D')
and parent_id = 83
and not exists (select id from lbs_person) 语法没错误,你找找是不是字符类型的错,把错误的id号写出来