Home >Database >Mysql Tutorial >MySQL查询某个列中相同值的数量统计_MySQL

MySQL查询某个列中相同值的数量统计_MySQL

WBOY
WBOYOriginal
2016-06-01 12:59:311047browse

\

数据现在是这样的,我想确定出type列中的news和image。。。。甚至以后有其他值,他们分别有多少个。

 

SELECT
	type,
	count(1) AS counts
FROM
	material
GROUP BY
	type

count(1),代表统计第一列,写上1 比写 *的效率高!

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn