統計支付寶交易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
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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.