为此,请使用 GROUP BY 和 ORDER BY: select yourColumnName, count(*) as anyAliasName from yourTableName group by yourColumnName order by yourColumnName;让我们创建一个表: mysql> create table demo7 -> ( -> id int NOT NULL AUTO_INCREMENT, -> first_name varchar(50) -> , -> primary key(id) -> ); 插入一些记录到表中: mysql> insert into demo7(first_name) values('John'); mysql> insert into demo7(first_name) values('David'); mysql> insert into demo7(first_name) values('John'); ... 阅读更多