How to sort concat_ws(‘,’,collect_list(a)) in MySQL?

I have a table with 2 columns time and text, where I want to concatenate text by the order of time.

I presto sql, I can do ARRAY_AGG(text ORDER BY time), how can I do it in MySQL? I found CONCAT_WS(',', COLLECT_LIST(text)) can do partial work, but not sure how to order by time in a quick way.

Thank you.

Read more here:

Content Attribution

This content was originally published by duoduolikes at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: