select a.name,b.bname,count(c.bid) from a,b,c where a.aid=b.aid and b.bid=c.bid group by a.name.b.bname order by 3 desc
select a.name,b.bname,d.bid,d.amount from a,b,( select bid,count(cid) amount from c group by bid) d where a.aid=b.aid and b.bid=c.did and c.bid=d.bid order by a.name,b.bname desc
a.name,b.bname,count(c.bid)
from
a,b,c
where
a.aid=b.aid
and
b.bid=c.bid
group by
a.name.b.bname
order by
3 desc
select a.name,b.bname,d.bid,d.amount
from a,b,(
select bid,count(cid) amount
from c
group by bid) d
where a.aid=b.aid
and b.bid=c.did
and c.bid=d.bid
order by a.name,b.bname desc