select b.bname,count(b.bname) as count from b left join a on a.aname = b.bname group by b.bname;全部展示b表的情况select b.bname,count(b.bname) as count from b right join a on a.aname = b.bname group by b.bname;全部展示a表的情况select b.bname,count(b.bname) as count from b inner join a on a.aname = b.bname group by b.bname;只输出有双方都有的情况