select id, count(id) from b , a a
where id(+)= a.id(+)
group by id看看这样可不可以

解决方案 »

  1.   

    select a.aid,(select count(*) from b where b.aid=a.aid) as count from a
      

  2.   

    select a.aid,count(b.aid) from a,b where a.id(+)=b.aid group by a.aid
      

  3.   

    select a.id,nvl((select count(1) from b where a.id=id),0) count from a;
      

  4.   

    select a.id,nvl((select count(1) from b where a.id=b.id(+)),0) count from a;
      

  5.   

    select a.aid,count(b.aid) from a,b where a.id=b.aid(+) group by a.aid
      

  6.   

    select a.id, NVL(c.num,0) from a,
    ( select aid, count(*) num from b group by aid ) c
    where a.id=c.aid(+)