Oracle 过滤相同的记录关键字



 当查询一张表同时需要过滤跟另一张表中相同的记录时 需要用到 not exists 关键字,因为==或!=不能为结果集。

select o.* from organization o where o.org_type=1 and not exists 
(select 'x' from organization_config c where o.org_name=c.org_name)

 效率也高,如果用

select * from organization o where o.org_name !=(select config.org_name from organization_config config )

 会报    错误!即子记录不能为结果集!

猜你喜欢

转载自840536410.iteye.com/blog/2007366