如何在 Redshift 中将 varchar 连接成字符串 table

How to concatenate varchar into a string in Redshift table

我有一个table如下:

create table #t1(a1 varchar(2))

insert into #t1 select 'AA'
insert into #t1 select 'BB'

我想要最终结果如下:我应该使用哪个聚合函数。

'AA,BB'

来自LISTAGG Function - Amazon Redshift

select listagg(sellerid, ', ') within group (order by sellerid) from sales
where eventid = 4337;

listagg                                                                                                                                 
----------------------------------------------------
380, 380, 1178, 1178, 1178, 2731, 8117, 12905, 32043