Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a data set that looks like this stored in big query.
ID Object
1 A
1 B
1 C
2 A
2 D
I would like to load it so that it looks like this (all IDs are made into primary keys, and objects are concatenated):
ID Objects
1 A, B, C
2 A, D
I've tried using Group By, Aggregate, String_Agg, and Concat but none of them are working.
May be try this
[objects]:
Load ID,
Concat([Object], ', ') AS Object
GROUP BY ID;
SELECT ID, Object
FROM `db.objects`;
Try this
LOAD ID,
Concat(Object, ', ') as Object
From....
Group By ID;
I get this error:
You did add the source where you are loading from, right?
Lol, how would I know what you are doing wrong if you won't even share all the details :). Please share the logfile or the script?
May be try this
[objects]:
Load ID,
Concat([Object], ', ') AS Object
GROUP BY ID;
SELECT ID, Object
FROM `db.objects`;