oracle not in 查不出数据

来源:互联网 发布:jquery 转js 编辑:程序博客网 时间:2024/06/05 06:53

在oracle中,sql语句如下:

<pre name="code" class="plain">select * from xa_ajxx where ajxx_uuid not in (select ajxx_uuid from sl_zdajbgxq )
却查不出应有的数据,查询结果为空。

原因是 sl_zdajbgxq中存在着ajxx_uuid为空的数据。导致not in无法查出数据。

改成用not exists即可

select * from xa_ajxx aj where not exists (select ajxx_uuid from sl_zdajbgxq zd where zd.ajxx_uuid = aj.ajxx_uuid)


0 0
原创粉丝点击