用例相当简单。在postgres中,我可以将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中,从documentation page on aggregate functions中,我只能看到GROUP_CONCAT,它将上面items中的所有值合并成一个逗号分隔的字符串。
有没有可能以正确的数组而不是字符串的形式获取这些值?
发布于 2020-05-09 06:58:32
下面的内容可以帮助你把'‘和'’字符连接起来吗
SELECT
customer, concat('[',group_concat(product_name),']') as items
FROM transactions group by customer;https://stackoverflow.com/questions/61360855
复制相似问题