0

用例相当简单。在 postgres 中,我可以将 a 中的值聚合GROUP BY到一个数组中:

select
  customer,
  array_agg(product_name) as items
from transactions
group by customer

customer      items
-----------------------------------------------------------
john          [salad, pizza, beer, diapers, pasta, cheese]
joe           [cheese, beef, yoghurt, milk, water]

在 Exasol 中,从聚合函数的文档页面中,我只能看到将上面的GROUP_CONCAT所有值合并items为逗号分隔的字符串。

是否可以在适当的数组而不是字符串中获取这些值?

4

1 回答 1

2

以下是否可以帮助您仅连接 '[' 和 ']' 字符

SELECT 
customer, concat('[',group_concat(product_name),']') as items 
FROM transactions group by customer;
于 2020-05-08T22:58:32.277 回答