统计支付宝交易sql

select
    A.trandate as 结算日期,
    A.sm as 充值金额不大于1000的总金额,
    A.co as 充值金额大于1000的总笔数,
    B.sm as 充退金额不大于1000的总金额,
    B.co as 充退金额大于1000的总笔数 from


   (select a.trandate  ,a.sm , b.co from
         (
             select trandate,sum(tranamt) as sm from mafedb.t_zjyw_tranrechis b  where trancode ='2802'  and transtat='00' and trandate>='20141001' and trandate<='20161130' and  to_number(tranamt)<=1000 group by  trandate
         ) a
    full outer join
         (select trandate,count(*) as co from mafedb.t_zjyw_tranrechis b  where trancode ='2802'  and transtat='00' and trandate>='20141001' and trandate<='20161130' and  to_number(tranamt)>1000 group by  trandate ) b


     on a.trandate=b.trandate ) A
 full outer join
  (select a.trandate  ,a.sm , b.co from
         (
             select trandate,sum(tranamt) as sm from mafedb.t_zjyw_tranrechis b  where trancode ='2803'  and transtat='00' and trandate>='20141001' and trandate<='20161130' and  to_number(tranamt)<=1000 group by  trandate
         ) a
    full outer join
         (select trandate,count(*) as co from mafedb.t_zjyw_tranrechis b  where trancode ='2803'  and transtat='00' and trandate>='20141001' and trandate<='20161130' and  to_number(tranamt)>1000 group by  trandate ) b


     on a.trandate=b.trandate) B




   on A.trandate=B.trandate  order by A.trandate asc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值