如何在Presto/Hive中使用SQL查询创建数组?
有两个记录:
类型 | 名称 |
---|---|
果实 | 苹果 |
果橙 | 橙色 |
我需要在presto中使用SQL查询:
键入 | 名称 |
---|---|
果实 | [“苹果”,“橙色”] |
我该如何编写SQL查询以获取桌子上方?
There are two records:
Type | name |
---|---|
Fruit | Apple |
Fruit | Orange |
I need below output using sql query in presto:
Type | name |
---|---|
Fruit | ["Apple","Orange"] |
How can I write the sql query to get above table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
聚合函数
array_agg
特别是设计了为此目的:输出:
Aggregate function
array_agg
is designed especially for this purpose:Output: