select type,name,sum(numa) numa,sum(numb) numb from (select type,name,1 numa,0 numb from a union all select type,name,0 numa,1 numb from b) group by type,name
select t.type,t.name, nvl(t.num,0),nvl(s.num,0) from (select type, name ,count(*)as num from a group by type, name )t, (select type, name ,count(*)as num from b group by type, name )s where t.type = s.type(+) and t.name = s.name(+) union select s.type,s.name, nvl(t.num,0),nvl(s.num,0) from (select type, name ,count(*)as num from a group by type, name )t, (select type, name ,count(*)as num from b group by type, name )s where s.type = t.type(+) and s.name = t.name(+)
select type,name,count(numa) numa,count(numb) numb from (select * from a union all select * from b) group by type,name
select a.type,a.name,a.acount,b.acount from (select type, name, count(name) acount from a group by type,name) a, (select type, name, count(name) bcount from b group by type,name) b where a.type=b.type and a.name=b.name order by a.name
(select type, name ,count(*)as num from a group by type, name )t,
(select type, name ,count(*)as num from b group by type, name )s
where t.type = s.type(+) and t.name = s.name(+)
union
select s.type,s.name, nvl(t.num,0),nvl(s.num,0) from
(select type, name ,count(*)as num from a group by type, name )t,
(select type, name ,count(*)as num from b group by type, name )s
where s.type = t.type(+) and s.name = t.name(+)
from (select * from a union all select * from b)
group by type,name
(select type, name, count(name) acount from a group by type,name) a,
(select type, name, count(name) bcount from b group by type,name) b
where a.type=b.type and a.name=b.name
order by a.name