zoukankan      html  css  js  c++  java
  • 建工项目对账查询引擎sql

    select * from ((select gl_detail.explanation,
           bd_accsubj.dispname,
           gl_detail.debitamount 借方,
           gl_detail.creditamount 贷方,
           gl_detail.yearv,
           gl_detail.periodv ,
           gl_voucher.no 凭证号,       
           wmsys.wm_concat(gl_freevalue.valuecode) valuecode,
           wmsys.wm_concat(gl_freevalue.valuename) valuename
      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
     where gl_detail.dr = '0'
       and  gl_detail.yearv>=#byear#
        and gl_detail.pk_systemv!='TR'
    and bd_accsubj.subjcode not in('41040107','41040109','41040207','41040209','41040307','41040308')
       and bd_glorgbook.glorgbookcode = (select glorgbookcode from bd_glorgbook where  pk_glbook='0001AA10000000004VTQ' and 
       (substr(glorgbookcode,1,6)=(select unitcode from bd_corp where pk_corp=#LoginCorp#)) )
       and gl_freevalue.valuecode like #duty# ||'%' 
    group by gl_detail.explanation,
              bd_accsubj.dispname,
              gl_detail.creditamount,
              gl_detail.debitamount,
              gl_detail.yearv,
              gl_detail.periodv,
              gl_voucher.no)
     union 
     (select gl_detail.explanation,
           bd_accsubj.dispname,
           gl_detail.debitamount 借方,
           gl_detail.creditamount 贷方,
           gl_detail.yearv,
           gl_detail.periodv ,
           gl_voucher.no 凭证号,       
           wmsys.wm_concat(gl_freevalue.valuecode) valuecode,
           wmsys.wm_concat(gl_freevalue.valuename) valuename
      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
     where gl_detail.dr = '0'
       and  gl_detail.yearv>=#byear#
    and gl_detail.pk_systemv!='TR'
       and bd_glorgbook.glorgbookcode = (select glorgbookcode from bd_glorgbook where  pk_glbook='0001AA10000000004VTQ' and 
       (substr(glorgbookcode,1,6)=(select unitcode from bd_corp where pk_corp=#LoginCorp#)) )
       and 
    ( bd_accsubj.subjcode  like '2120'||substr(#accsubj#,-2,2)||'%' 
    or
    ( bd_accsubj.subjcode='5402' and gl_detail.explanation like '%' ||#explain#||'%')
    )
     group by gl_detail.explanation,
              bd_accsubj.dispname,
              gl_detail.creditamount,
              gl_detail.debitamount,
              gl_detail.yearv,
              gl_detail.periodv,
              gl_voucher.no))
     order by yearv,periodv,dispname

    
    
  • 相关阅读:
    Jmeter_实现操作postgresql数据库
    测试人员如何使用Git部署测试环境
    GitLab简单使用
    ssh: Could not resolve hostname git.*****-inc.com : Temporary failure in name resolution fatal: The remote end hung up unexpectedly
    本地Linux服务器上配置Git
    SeleniumIDE_初识
    自动化测试_测试模型
    Top命令详解02
    【Linux性能调优一】观大局:系统平均负载load average
    【自动化专题】借助firefox插件定位web元素小技巧
  • 原文地址:https://www.cnblogs.com/sumsen/p/2538315.html
Copyright © 2011-2022 走看看