select t1.a, t1.cnt0,nvl(t2.cnt1,0) from (select a,count(*) as cnt0 from test group by a) t1, (select a,count(*) as cnt1 from test where b > 1 group by a) t2 where t1.a = t2.a(+)
select d.a,count(d.*),(select count(c.*) from table c where c.a= d.a and c.b > 1 ) from table d group by a
(select a,count(*) as cnt0 from test group by a) t1,
(select a,count(*) as cnt1 from test where b > 1 group by a) t2
where t1.a = t2.a(+)