我想使用 LISTAGG 在 Amazon Athena 中进行查询。有什么方法可以将数据聚合到列表或字符串中?
grouping_expressions 元素可以是任何函数(如 SUM、AVG、COUNT 等)
我想使用 LISTAGG 在 Amazon Athena 中进行查询。有什么方法可以将数据聚合到列表或字符串中?
grouping_expressions 元素可以是任何函数(如 SUM、AVG、COUNT 等)
with t(i) as (select 1 union all select 2 union all select 3)
select array_agg(i) as result
from t
;
result
-----------
[3, 2, 1]
with t(i) as (select 1 union all select 2 union all select 3)
select array_join(array_agg(i),',') as result
from t
;
result
--------
1,3,2