开发者

count of a value in a column in mysql database

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜