<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    licheng700

    BlogJava 首頁 新隨筆 聯系 聚合 管理
      26 Posts :: 5 Stories :: 5 Comments :: 1 Trackbacks

    select  n_accountid,accountNO,accountName ,
    sum(decode(n_direction,1,n_amount, 0)) amountOfDebit,
    sum(decode(n_direction,2,n_amount, 0)) amountOfCredit,
    sum(n_amount) amount,
    sum(decode(n_direction,1,1, 0)) numOfDebitTrans,
    sum(decode(n_direction,2,1, 0)) numOfCreditTrans,
    COUNT(n_direction) nums
    from

    (select a.n_accountid n_accountid ,
    a.n_amount n_amount,a.n_direction n_direction,
    b.s_accountno accountNO,b.s_accountname  accountName from

    (select n_id ,n_accountid,n_currencytype,n_amount,n_direction,dt_modifytime from bs_accthistransinfo where 1=1
     and to_char(dt_modifytime,'yyyy-mm-dd')>='2005-01-01'
     and to_char(dt_modifytime,'yyyy-mm-dd')<='2006-01-01'
     union all
    select n_id ,n_accountid,n_currencytype,n_amount,n_direction,dt_modifytime from bs_acctcurtransinfo where 1=1
     and to_char(dt_modifytime,'yyyy-mm-dd')>='2005-01-01'
     and to_char(dt_modifytime,'yyyy-mm-dd')<='2006-01-01'
    )a,  

    (select n_id,s_accountno,s_accountname,n_currencytype from bs_bankaccountinfo where
        n_ischeck=1
     and n_accountstatus= 1)
     b
     where a.n_currencytype=b.n_currencytype  and a.n_accountid=b.n_id
    )
    c
    group by n_accountid,accountNO,accountName


     

    posted on 2005-08-25 16:31 小海船 閱讀(179) 評論(1)  編輯  收藏

    評論

    # re: 一段SQL 2005-08-25 17:02 小海船
    select n_accountid,accountNO,accountName ,
    sum(decode(n_direction,1,n_amount, 0)) amountOfDebit,
    sum(decode(n_direction,2,n_amount, 0)) amountOfCredit,
    sum(n_amount) amount,
    sum(decode(n_direction,1,1, 0)) numOfDebitTrans,
    sum(decode(n_direction,2,1, 0)) numOfCreditTrans,
    COUNT(n_direction) nums
    from
    (select a.n_id n_id,a.n_accountid n_accountid ,a.n_currencytype n_currencytype,
    a.n_amount n_amount,a.n_direction n_direction,a.dt_modifytime dt_modifytime,
    b.s_accountno accountNO,b.s_accountname accountName from
    (select n_id ,n_accountid,n_currencytype,n_amount,n_direction,dt_modifytime from bs_accthistransinfo where 1=1
    union all
    select n_id ,n_accountid,n_currencytype,n_amount,n_direction,dt_modifytime from bs_acctcurtransinfo where 1=1)
    a,
    (select * from bs_bankaccountinfo where
    n_accountstatus= 1
    and n_ischeck=1) b where a.n_currencytype=b.n_currencytype and a.n_accountid=b.n_id and
    to_char(a.dt_modifytime,'yyyy-mm-dd')>='2005-01-01' and
    to_char(a.dt_modifytime,'yyyy-mm-dd')<='2006-01-01'
    )c group by n_accountid,accountNO,accountName  回復  更多評論
      


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 最近中文字幕国语免费完整| 精品亚洲aⅴ在线观看| 亚洲精品免费网站| 国产精品内射视频免费| 亚洲熟妇AV乱码在线观看| 亚洲∧v久久久无码精品| 亚洲日韩精品无码专区网站 | 美腿丝袜亚洲综合| 黄网址在线永久免费观看 | 全部免费毛片免费播放| 中文字幕无码免费久久99 | 久久国产亚洲观看| 亚洲一区二区三区乱码A| 国产精品久久免费视频| 最近2019中文免费字幕| 成人午夜免费福利视频| 最近免费mv在线电影| 午夜视频在线免费观看| 两个人日本免费完整版在线观看1| 美美女高清毛片视频黄的一免费| 亚洲av永久中文无码精品| 亚洲中文字幕日本无线码| ass亚洲**毛茸茸pics| 亚洲日本在线免费观看| 亚洲视频免费在线播放| 久久久久亚洲AV无码专区首JN| 亚洲av中文无码乱人伦在线播放 | 美女黄网站人色视频免费| 亚洲日韩AV一区二区三区四区| 亚洲av无码电影网| 亚洲女人初试黑人巨高清| 亚洲国产高清美女在线观看| 亚洲国产精品无码久久久| 亚洲欧洲国产成人精品| 亚洲欧洲国产综合| 亚洲综合无码无在线观看| 亚洲综合色婷婷在线观看| 亚洲国产精华液2020| 色偷偷亚洲第一综合网| 全黄A免费一级毛片| 四虎永久在线精品免费一区二区|