oracle中查询多情况并存的情况

来源:互联网 发布:佛山网络推广方法 编辑:程序博客网 时间:2024/05/05 22:48
--查询EF_AR_HEADER 中满足对应的明细信息中的字段 ap_detail_no  null 和not null都存在的记录select a.ar_no from EF_AR_HEADER a where a.create_time > to_date('2017-02-01','yyyy-mm-dd')and exists ( select 1 from ef_ar_detail b where b.ar_no = a.ar_no              and ( select avg(nvl2(c.ap_detail_no,'1','0')) from ef_ar_detail c where c.ar_no = b.ar_no ) >0             and  ( select avg(nvl2(c.ap_detail_no,'1','0')) from ef_ar_detail c where c.ar_no = b.ar_no ) <1             );


第一篇文章记录

0 0
原创粉丝点击