create view vname as select t1.zd1,t1.c1,t2.c2 from (select zd zd1,count(1) c1 from a group by zd) t1,
(select zd zd2,count(1) c2 from b group by zd) t2
where t1.zd1 = t2.zd2(+);
(select zd zd2,count(1) c2 from b group by zd) t2
where t1.zd1 = t2.zd2(+);
select zd, sum(zd_count1) a_count,sum(zd_count2) b_count from
(
select zd, count(*) zd_count1, 0 zd_count2 from a group by zd
uinon all
select zd, 0 zd_count1, count(*) zd_count2 from b group by zd
) c
group by zd
select * from a
union all
select * from b这样?