Group by returning an array

@vsr1 is there a solution for this?

I have some documents, and I would like to group them by an attribute and generate an array on another attribute

something like

select pp, sum(pv), <an array of field “im”> from bucket group by pp

and the <an array of field “im”> should return something like [1,6,8]

Also, the values in the array should be unique (without duplicates)

Could this be done?

LATER EDIT:

I think I made it work with ARRAY_AGG(DISTINCT mi)

1 Like
select pp, sum(pv),  ARRAY_AGG(DISTINCT im)
from bucket 
group by pp
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.