create table lei(leibie varchar(10))
insert lei select 'a'
union select 'b'
union select 'c'
create table wenzhang(leibie varchar(10),zushu int)
insert wenzhang select 'a',1000
union select 'a',2000
union select 'b',10000
union select 'c',5000
select w.*,l.c from wenzhang w inner join (select leibie,count(*) as c from wenzhang group by leibie)
l on l.leibie=w.leibie
不知道符合不符合你要求