统计手机号码出现次数以及排列
有表a,里面有个phone字段。是手机号码的字段。
我想统计a表里phone相同手机号码出现的次数,然后做一个排序。从大到小。
应该怎么写呢?
[解决办法]
select phone,count(*) as 次数
from a
group by phone
having count(*)>1
order by 2 desc