On Thu, 12 Nov 2015 10:03:52 +0200, "'Louis van Alphen' [email protected] [firebird-support]" <[email protected]> wrote: > The document is quite slim on this. Is it possible to, for a parent row to > 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 http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-aggrfunc-list.html > > 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 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. Mark
