Mysql select a, group_concat(b separator ',') from table group by a Presto select a, array_join(array_agg(b), ',') from table group by a Redshift select a, listagg(b, ',') from table group by a