博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
北京仅项目发生sql_partition、minus
阅读量:6083 次
发布时间:2019-06-20

本文共 3772 字,大约阅读时间需要 12 分钟。

(select distinct       gl_detail.prepareddatev 制单日期,       gl_voucher.no 凭证号,       gl_voucher.explanation 摘要       from bd_accsubj  join gl_detail    on gl_detail.pk_accsubj = bd_accsubj.pk_accsubj  join bd_glorgbook    on bd_glorgbook.pk_glorgbook = bd_accsubj.pk_glorgbook  join gl_voucher    on gl_detail.pk_voucher = gl_voucher.pk_voucher  left join gl_freevalue    on gl_detail.assid = gl_freevalue.freevalueid  left join  bd_bdinfo    on gl_freevalue.checktype=bd_bdinfo.pk_bdinfo where gl_detail.dr = '0'   and gl_detail.yearv = '2011'   and gl_detail.periodv=07   and bd_glorgbook.glorgbookcode = '010201-0001'   and gl_detail.explanation<>'期初'   and bd_bdinfo.bdname='工程项目'   and bd_accsubj.subjcode like '4104%' ) minus (select distinct 制单日期,凭证号,摘要 from (select  gl_detail.explanation,        bd_accsubj.dispname,        gl_detail.debitamount 借方,        gl_detail.creditamount 贷方,        gl_detail.prepareddatev 制单日期,        gl_voucher.no 凭证号,        gl_voucher.explanation 摘要,        gl_freevalue.valuecode ,        gl_freevalue.valuename ,       gl_detail.detailindex,       gl_detail.pk_systemv ,       sum(decode(length(gl_freevalue.valuecode),11,1,0)) over(partition by gl_voucher.no) x1,       sum(decode(length(gl_freevalue.valuecode),10,1,0)) over(partition by gl_voucher.no) x2  from bd_accsubj  join gl_detail    on gl_detail.pk_accsubj = bd_accsubj.pk_accsubj  join bd_glorgbook    on bd_glorgbook.pk_glorgbook = bd_accsubj.pk_glorgbook  join gl_voucher    on gl_detail.pk_voucher = gl_voucher.pk_voucher  left join gl_freevalue    on gl_detail.assid = gl_freevalue.freevalueidwhere gl_detail.dr = '0'   and gl_detail.explanation<>'期初'   and gl_detail.yearv = '2011'   and gl_detail.periodv='07'   and bd_glorgbook.glorgbookcode = '010201-0001'   and (length(gl_freevalue.valuecode)='10' or length(gl_freevalue.valuecode)='11')   )   where x1>0 and x2>0)   order by 制单日期,凭证号(select distinct       gl_detail.prepareddatev 制单日期,       gl_voucher.no 凭证号,       gl_voucher.explanation 摘要       from bd_accsubj  join gl_detail    on gl_detail.pk_accsubj = bd_accsubj.pk_accsubj  join bd_glorgbook    on bd_glorgbook.pk_glorgbook = bd_accsubj.pk_glorgbook  join gl_voucher    on gl_detail.pk_voucher = gl_voucher.pk_voucher  left join gl_freevalue    on gl_detail.assid = gl_freevalue.freevalueid  left join  bd_bdinfo    on gl_freevalue.checktype=bd_bdinfo.pk_bdinfo where gl_detail.dr = '0'   and gl_detail.yearv = '2011'   and gl_detail.periodv=07   and bd_glorgbook.glorgbookcode = '010201-0001'   and gl_detail.explanation<>'期初'   and bd_bdinfo.bdname='工程项目'   and bd_accsubj.subjcode like '4104%' ) minus (select distinct 制单日期,凭证号,摘要 from (select  gl_detail.explanation,        bd_accsubj.dispname,        gl_detail.debitamount 借方,        gl_detail.creditamount 贷方,        gl_detail.prepareddatev 制单日期,        gl_voucher.no 凭证号,        gl_voucher.explanation 摘要,        gl_freevalue.valuecode ,        gl_freevalue.valuename ,       gl_detail.detailindex,       gl_detail.pk_systemv ,       sum(decode(length(gl_freevalue.valuecode),11,1,0)) over(partition by gl_voucher.no) x1,       sum(decode(length(gl_freevalue.valuecode),10,1,0)) over(partition by gl_voucher.no) x2  from bd_accsubj  join gl_detail    on gl_detail.pk_accsubj = bd_accsubj.pk_accsubj  join bd_glorgbook    on bd_glorgbook.pk_glorgbook = bd_accsubj.pk_glorgbook  join gl_voucher    on gl_detail.pk_voucher = gl_voucher.pk_voucher  left join gl_freevalue    on gl_detail.assid = gl_freevalue.freevalueidwhere gl_detail.dr = '0'   and gl_detail.explanation<>'期初'   and gl_detail.yearv = '2011'   and gl_detail.periodv='07'   and bd_glorgbook.glorgbookcode = '010201-0001'   and (length(gl_freevalue.valuecode)='10' or length(gl_freevalue.valuecode)='11')   )   where x1>0 and x2>0)

转载地址:http://sckwa.baihongyu.com/

你可能感兴趣的文章
Django中ORM介绍和字段及其参数
查看>>
[汇编学习笔记][第十七章使用BIOS进行键盘输入和磁盘读写
查看>>
【并查集合并注意!!!!】【最小生成树】
查看>>
【最大流】【HDU3572】Task Schedule
查看>>
iOS - Photo Album 图片/相册管理
查看>>
0723作业
查看>>
2016蓝桥杯 煤球数目 (代码)
查看>>
DOM&BOM
查看>>
a标签设置锚点定位div
查看>>
LightOJ 1079 Just another Robbery
查看>>
【NFS】nfs安装调优
查看>>
Linux 下子线程 exit code 在主线程中的使用
查看>>
类的实例化
查看>>
axios 获取不到数据错误
查看>>
一文掌握Docker Compose
查看>>
9.5 考试 第一题 礼物题解
查看>>
数据结构占坑
查看>>
【Laravel】安装并且运行
查看>>
设计模式之代理模式(一)
查看>>
My platform info!
查看>>