select *
FROM LPEdorItem a, LCCont b, LPEdorApp c
WHERE a.edoracceptno = c.edoracceptno
and a.ContNo = b.ContNo
and b.appntno = '0000235356'
AND b.conttype = '1' --'2-集体总单,1-个人总投保单';
AND (c.AppType != '6' OR c.AppType is null) -- 申请方式
and a.edorvalidate >= trunc(sysdate) - 365
and a.edorvalidate <= trunc(sysdate)
and c.makedate between to_date('20190101', 'yyyy-mm-dd') and
to_date('20201117', 'yyyy-mm-dd')
and b.familytype <> '1'
and (case
when a.edorstate in ('0', 'j', '4', '9', 'c', 'd') and
(not exists (select 1
from ljaget t
where t.otherno = a.edoracceptno
and t.confdate is null
and t.sumgetmoney <> 0) or EXISTS
(SELECT 1
FROM LJMONETARYSTERILIZATIONB LJM
WHERE LJM.OTHERNO = A.contno)) then
'1'
else
'0'
end) = '1'

 简化

-->>>>这两个是等同的
select *
from LPEdorItem a
where (case
when a.edorstate in ('0', 'j', '4', '9', 'c', 'd')then
'1'
else
'0'
end) = '1'
--------------------------------------------------------------------------------
select * from LPEdorItem a where a.edorstate in ('0', 'j', '4', '9', 'c', 'd')

 解释: { when 条件 then '1'}= '1' 这等同于where条件  where a.edorstate in ('0', 'j', '4', '9', 'c', 'd')

select *
from LPEdorItem a
where (not exists (select 1
from ljaget t --实付总表
where t.otherno = a.edoracceptno
and t.confdate is null --财务确认日期
and t.sumgetmoney <> 0) --总给付金额
or EXISTS
(SELECT 1
FROM LJMONETARYSTERILIZATIONB LJM
WHERE LJM.OTHERNO = A.contno))

 再简化 

 

最新文章

  1. UIWebView、WKWebView使用详解及性能分析
  2. system generator 卷积编码器快速设计
  3. 已知树的前序、中序,求后序的java实现&amp;已知树的后序、中序,求前序的java实现
  4. ruby -- 进阶学习(十)自定义路由中:new, :collection和:member的区别
  5. 154 Find Minimum in Rotated Sorted Array II
  6. 【Linux/Ubuntu学习2】ubuntu-ubuntu10.04使用wine安装SourceInsight
  7. 新的HTTP框架:Daraja Framework
  8. I/O多路转接 --- UNIX环境高级编程
  9. sqlsever连接两个不同服务器上的数据库进行查询
  10. AngularJS最理想开发工具WebStorm
  11. codevs2019 Uva10029 递变阶梯
  12. [leetcode-554-Brick Wall]
  13. [Bootstrap 源码]——bootstrap源码之初始化
  14. HTML 中的预留字符(如标签的小于号 &lt; )必须被替换为字符实体( &amp;lt; )。 不间断空格(&amp;nbsp;)
  15. mac下启动mysql
  16. MariaDB基础详解
  17. cookies和session
  18. JAVA实操项目:转账接口设计
  19. flask基础之Response响应对象(九)
  20. UOJ #146. 【NOIP2015】信息传递 连通分量 tarjan模板题

热门文章

  1. MySQL分页查询limit踩坑记
  2. 想玩转JAVA高并发,这些概念你必须懂
  3. UNREFERENCED_PARAMETER的用处
  4. VisualCom软件仿真平台V1.0发布(附安装包下载链接)
  5. 解决“与 Microsoft Exchange 的连接不可用,Outlook 必须联机或已连接才能完成此操作”
  6. Go语言深度比较值是否相等
  7. MaterialDesignInXamlToolkit“无法绑定到目标方法,因其签名或安全透明度与委托类型的签名或安全透明度不兼容”异常的解决思路
  8. 什么是OSI的第7层
  9. 关于asp.net中Repeater控件的一些应用
  10. 移动端touch、click、tap的区别