标签: mysql select count distinct
需要编写MySQL查询来检查数据库表并获取不同的值及其计数。
select distinct(fruits), count(distinct(fruits)) from table;
这样就够了吗?
答案 0 :(得分:3)
为什么不使用group by
group by
select fruits, count(fruits) as fc from table group by fruits order by fc desc;