Shi*_*Kim 1 amazon-web-services amazon-athena
我想使用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]
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1851 次 |
| 最近记录: |