I have a huge table (i.e. 3 million rows) in Google BigQuery. The structure is something like this:
name1 attribute1
name2 attribute2
name1 attribute2
I'd now like to get a list per name of the attributes that they have. So for the example above, I would want something like this:
name1 attribute1, attribute2
name2 attribute2
Is this possible with BigQuery (so without having to write any code, just purely as an SQL query)?
I suggest that you use the GROUP_CONCAT function:
SELECT name, GROUP_CONCAT(columnNameContainingTheAttribute)
FROM yourTable
GROUP BY name
You can learn more about the GROUP_CONCAT function here: https://developers.google.com/bigquery/query-reference?hl=FR#aggfunctions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With