0

需要编写一个 MySQL 查询来检查数据库表并获取不同的值及其计数。

在此处输入图像描述

select distinct(fruits), count(distinct(fruits)) from table;

这足够了吗?

4

1 回答 1

3

为什么不使用group by

select fruits, count(fruits) as fc
from table
group by fruits
order by fc desc;
于 2013-01-09T11:51:53.087 回答