Subject | Re: [firebird-support] How does LIST() work? |
---|---|
Author | Mark Rotteveel |
Post date | 2015-11-12T09:03:08Z |
On Thu, 12 Nov 2015 10:03:52 +0200, "'Louis van Alphen' louis@...
[firebird-support]" <firebird-support@yahoogroups.com> wrote:
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-aggrfunc-list.html
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.
Mark
[firebird-support]" <firebird-support@yahoogroups.com> wrote:
> The document is quite slim on this. Is it possible to, for a parent rowto
> retrieve child rows and 'pack' a column from the detail rows into a listIt does exactly what it says on
> using the LIST function?
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-aggrfunc-list.html
>You would also need to GROUP BY on all columns of PARENT (P), and you need
> E.g. something like
>
> Select
> P.*,
> LIST(C.ID)
> from PARENT P
> join CHILD C on C.PARENT_ID = P.ID
>
> to yield
>
> P_COLUMN_VALUE 1,2,3,4
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.
Mark