Eda*_*ame 3 sql concatenation presto
我有一张桌子:my_table
customer_id
-------------
2156
6781
3145
1235
9874
Run Code Online (Sandbox Code Playgroud)
我希望输出是一个带有逗号的串联字符串,例如:2156, 6781, 3145, 1235, 9874
到目前为止,我导出了表并使用 python 来执行此操作。我想知道我可以直接在 Presto 查询中执行此操作吗?谢谢!
我认为 Presto 没有字符串聚合。相反,聚合为数组并转换为字符串:
select array_join(array_agg(customer_id), ', ') as customer_ids
from my_table
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7511 次 |
| 最近记录: |