select ABcnt=sum(ABcnt),ABcredit=sum(ABcredit) from
(
select count(*) as ABcnt,sum(credit) as ABcredit from A
union all
select count(*) as ABcnt,sum(credit) as ABcredit from B
)a