tags:

views:

25

answers:

2

i have a large mysql database 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 ?

+2  A: 

You use grouping:

select TheValue, count(*)
from TheTable
group by TheValue
order by TheValue
Guffa
+2  A: 
select column, count(*) from table group by column
rerun