开发者

count of a value in a column in mysql database

开发者 https://www.devze.com 2022-12-21 18:10 出处:网络
i have a large mysql database 开发者_JAVA技巧table in which one column contains values rangingfrom 1 to 9

i have a large mysql database 开发者_JAVA技巧table in which one column contains values ranging from 1 to 9 what query can i give so that i can get the count of 1s and 2s and 3s ... 9s in that column in the database ?


select column, count(*) from table group by column


You use grouping:

select TheValue, count(*)
from TheTable
group by TheValue
order by TheValue
0

精彩评论

暂无评论...
验证码 换一张
取 消