I\'m new to Presto and looking to get the same functionality as the group_concat function in MySQL. Are the following two equivalent? If not, any suggestions for how I can r
Try using this in place of group_concat in Presto ::
select
a,
array_join(array_agg(b), ',')
from table
group by a
Also, if you're looking for unique values only – an equivalent to group_concat(distinct ... separator ', ')
– try this:
array_join(array_distinct(array_agg(...)), ', ')
There's no function as of this answer, though the feature has been requested.
The closest equivalent is mentioned in your question.
WITH tmp AS (
SELECT 'hey' AS str1
UNION ALL
SELECT ' there'
)
SELECT array_join(array_agg(str1), ',', '') AS joined
FROM tmp