假设表示姓名的字段名称为name,则可以用group by name 将姓名分组,然后统计单个姓名出现的次数。
select count(name) count,name from table group by name order by count desc
select count(name) count,name from table group by name order by count desc
调试欢乐多
select *,sum(name=name) as total from table group by name order by total desc
但不理解 sum(name=name)是什么意思?希望能提示一下!结贴!