BigQuery:如何计算重复字段中的特定值?
BigQuery: how to count specific values in a REPEATED field?
我在 BigQuery table.
中有一个 STRING REPEATED 字段
这是此类字段的行列表:
- "A"
- "A","C","E"
- "B,"E"
- "A","B","D"
- "D","E"
如何计算所有单个值出现的总次数?
我试过 "GROUP BY",但似乎无法按重复字段进行分组
您想 UNNEST 然后计数:
SELECT x, COUNT(*) AS c
FROM T, UNNEST(array_column) AS x
GROUP BY x
我在 BigQuery table.
中有一个 STRING REPEATED 字段这是此类字段的行列表:
- "A"
- "A","C","E"
- "B,"E"
- "A","B","D"
- "D","E"
如何计算所有单个值出现的总次数?
我试过 "GROUP BY",但似乎无法按重复字段进行分组
您想 UNNEST 然后计数:
SELECT x, COUNT(*) AS c
FROM T, UNNEST(array_column) AS x
GROUP BY x