2021年3月29日星期一

BigQuery, using ARRAY_AGG to create comma delimited results

I need to make this table generate results like this below, to create a CSV. The query need to show all values Familia and Year belonging to the same SKU together being comma separated

SKU;FAMILIA;ANO  203939393;FAMILIA COROLLA, FAMILIA CBU, FAMILIA HILUX;2008,2009,2010  

Im using BIGQUERY and try this function

SELECT  FORMAT("%T", ARRAY_AGG(x limit 100)) AS array_agg  FROM `Toyoparts.csv_compatibilidade` AS x  

But it just make a huge array. Im beginner in SQL, if anyone could help.

https://stackoverflow.com/questions/66863868/bigquery-using-array-agg-to-create-comma-delimited-results March 30, 2021 at 10:06AM

没有评论:

发表评论