Reputation: 6292
I have a column with different text values. How can I get a list of all the unique values and the count of the appearance of them in the column?
Upvotes: 0
Views: 108
Reputation: 15079
Simplest way is to use GROUP BY
select text_column, count(*) from text_table group by text_column
more info - http://www.w3schools.com/sql/sql_groupby.asp
Upvotes: 3
Reputation: 1364
SELECT column_name
, COUNT(*)
FROM table_name
GROUP BY column_name
;
Upvotes: 1