对一个sql的分析
2024-09-01 15:44:58
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))
再简化
最新文章
- UIWebView、WKWebView使用详解及性能分析
- system generator 卷积编码器快速设计
- 已知树的前序、中序,求后序的java实现&;已知树的后序、中序,求前序的java实现
- ruby -- 进阶学习(十)自定义路由中:new, :collection和:member的区别
- 154 Find Minimum in Rotated Sorted Array II
- 【Linux/Ubuntu学习2】ubuntu-ubuntu10.04使用wine安装SourceInsight
- 新的HTTP框架:Daraja Framework
- I/O多路转接 --- UNIX环境高级编程
- sqlsever连接两个不同服务器上的数据库进行查询
- AngularJS最理想开发工具WebStorm
- codevs2019 Uva10029 递变阶梯
- [leetcode-554-Brick Wall]
- [Bootstrap 源码]——bootstrap源码之初始化
- HTML 中的预留字符(如标签的小于号 <; )必须被替换为字符实体( &;lt; )。 不间断空格(&;nbsp;)
- mac下启动mysql
- MariaDB基础详解
- cookies和session
- JAVA实操项目:转账接口设计
- flask基础之Response响应对象(九)
- UOJ #146. 【NOIP2015】信息传递 连通分量 tarjan模板题
热门文章
- MySQL分页查询limit踩坑记
- 想玩转JAVA高并发,这些概念你必须懂
- UNREFERENCED_PARAMETER的用处
- VisualCom软件仿真平台V1.0发布(附安装包下载链接)
- 解决“与 Microsoft Exchange 的连接不可用,Outlook 必须联机或已连接才能完成此操作”
- Go语言深度比较值是否相等
- MaterialDesignInXamlToolkit“无法绑定到目标方法,因其签名或安全透明度与委托类型的签名或安全透明度不兼容”异常的解决思路
- 什么是OSI的第7层
- 关于asp.net中Repeater控件的一些应用
- 移动端touch、click、tap的区别