我有一个简单的BigQuery查询:
SELECT GroupingColumn, ... FROM Table GROUP BY GroupingColumn
有没有办法在嵌套数组中返回与GroupingColumn匹配的记录的所有列?
+-----------------+------------------------------------------------+
| GroupingColumn1 | ARRAY of objects containing all the columns |
+-----------------+------------------------------------------------+
| Column1val | [ { Column2, Column3 }, { Column2, Column3 } ] |
| Column1val | ... |
+-----------------+------------------------------------------------+
答案 0 :(得分:2)
您可以使用ARRAY_AGG
:
SELECT GroupingColumn, ARRAY_AGG(...)
FROM Table GROUP BY GroupingColumn