Reputation: 89
I have a column of stings in a Hive table and I want to count the number of occurrences of each string in this column. How can I do that?
Upvotes: 0
Views: 3790
Reputation: 754
Query that I think is correct:
SELECT columnA,columnB,COUNT(distinct column C)
from table_name
group by columnA,columnB
Is this correct? SQL is fine too.
Upvotes: 0
Reputation: 74249
It sounds like you need to group by the column and then count the number of items in each group. Something like this:
SELECT somecolumn, count(1) AS count
FROM sometable
GROUP BY somecolumn
Upvotes: 3