I would like to ask about a script in BigQuery. So, I tried to use a query below
SELECT id, STRING_AGG(DISTINCT status, ', ' ORDER BY timestamp) AS grouping
FROM table
GROUP BY id
But I couldn't run it since it gave me an error
An aggregate function that has both DISTINCT and ORDER BY arguments can only ORDER BY expressions that are arguments to the function
Could anyone help me to fix the error? Thank you in advance!
status- whichtimestampof multiple rows with that status you want to use? this is why it is not supported inSTRING_AGGas is because it just would not know how to order. So you need to clarify your requirements/expectations for us to help you