|Subject||Re: [firebird-support] How does LIST() work?|
Thursday, November 12, 2015, 9:03:52 PM, you 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?
E.g. something like
from PARENT P
join CHILD C on C.PARENT_ID = P.ID
You could use a correlated subquery:
(select cast (list(e.emp_no) as varchar(100)) from employee e
where e.dept_no = d.dept_no) as emplist
from department d
The cast is necessary to get the output in your example, as the LIST() result is a text BLOB.