Subject Re: [firebird-support] How does LIST() work?
Author Mark Rotteveel
On Thu, 12 Nov 2015 10:03:52 +0200, "'Louis van Alphen' louis@...
[firebird-support]" <> wrote:
> The document is quite slim on this. Is it possible to, for a parent row
> retrieve child rows and 'pack' a column from the detail rows into a list
> using the LIST function?

It does exactly what it says on

> E.g. something like
> Select
> P.*,
> from PARENT P
> join CHILD C on C.PARENT_ID = P.ID
> to yield
> P_COLUMN_VALUE 1,2,3,4

You would also need to GROUP BY on all columns of PARENT (P), and you need
to keep in mind that the order of values is not deterministic (it could
just as well be 4,2,1,3).
Note that this has nothing to do with a parent row retrieving child rows,
you are constructing a set from the parent joined to its child, then you
group by a number of columns and aggregrate other column(s). What LIST does
is similar to what SUM does, but instead of creating a sum, it joins values
with a separator.