I have two tables Table_1 and Table_2 in the database as below:
The datatype of Name column is STRING and that of Matches column is ARRAY<INT64>. For each name, there can be one or more matches. For example, in Table_1, N1 has matches [1, 2]. I want to combine both Table_1 and Table_2, and generate a Result table like below:
In the Result table, the distinct match ID will come from the Matches column of both the tables and the Names column will show the names from both table related to the specific ID. For example, In Table_1, both N1 and N2 has a match with 1. So, in the Result table, we will have a row for 1 with N1, N2 as a comma separated in the Names column.
How can I achieve using Group BY and Aggregation in Google BigQuery?




