Reputation: 20442
I have a STRING REPEATED field in a BigQuery table.
this is a list of rows for such field:
How can I count the total number of occurrencies of all single values?
I tried with "GROUP BY", but it seems that it's not possible to GROUP BY a REPEATED field
Upvotes: 1
Views: 2018
Reputation: 33765
You want to UNNEST and then count:
SELECT x, COUNT(*) AS c
FROM T, UNNEST(array_column) AS x
GROUP BY x
Upvotes: 5