mysql 字段一重复 根据字段二最大值统计

图片说明
就像这种,type为4只有两个,3有1个,2有1个,1有4个, 像wei111既有1也有4,只统计最大,可以只用一句sql语句统计吗?

如果第一列为name,第二列为type
select name,max(type) from xxx group by name

select count(*),type from table group by type


图片说明
select DISTINCT name,MAX(type) from test GROUP BY name;

SELECT wei111,COUNT(type) FROM tablename GROUP BY wei111 HAVING MAX(type)

select distinct name,max(type) from test group by name;

select name,MAX(type) from test GROUP BY name;