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

前端之家收集整理的这篇文章主要介绍了oracle中查询多情况并存的情况前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. --查询EF_AR_HEADER 中满足对应的明细信息中的字段 ap_detail_no null not null都存在的记录
  2. select a.ar_no from EF_AR_HEADER a
  3. where a.create_time > to_date('2017-02-01','yyyy-mm-dd')
  4. and exists ( select 1 from ef_ar_detail b where b.ar_no = a.ar_no
  5. and ( select avg(nvl2(c.ap_detail_no,'1','0')) from ef_ar_detail c where c.ar_no = b.ar_no ) >0
  6. and ( select avg(nvl2(c.ap_detail_no,'0')) from ef_ar_detail c where c.ar_no = b.ar_no ) <1
  7. );


第一篇文章记录

猜你在找的Oracle相关文章