MySQL里面用的是group_concat,PgSQL没有这个函数,可以使用下面的方式聚合:

select bb, array_to_string(array_agg(aa),',')  aa from table group by bb