Consider the following setup:

create table x (a int, b int);
insert into x
values
(1,1),
(1,2),
(2,5),
(2,6),
(2,7);

Now run the following query:

   select a, array_agg(b)
   from x
   group by a;

This returns:

A  | ARRAY_AGG(B)
-----------------
1  | (1, 2)
2  | (5, 6, 7)

Now if you add an order by to the aggregate

    select a, array_agg(b order by b)
    from x
    group by a;

This returns:

A  | ARRAY_AGG(B ORDER BY B)
-----------------------------
1  | ((1, 1), (2, 2))
2  | ((5, 5), (6, 6), (7, 7))

So every element in the array is duplicated and is returned as another array.

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to