Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
需要编写一个 MySQL 查询来检查数据库表并获取不同的值及其计数。
select distinct(fruits), count(distinct(fruits)) from table;
这足够了吗?
为什么不使用group by
group by
select fruits, count(fruits) as fc from table group by fruits order by fc desc;