LoginSignup
16
11

More than 5 years have passed since last update.

Mysqlのgroup_concatをPrestoとRedshiftで書く

Posted at

Mysqlのgroup_concatをPrestoとRedshiftで書く際に毎回混乱するのでメモ

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
16
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
11