comma-separated list as a result of select statement in Oracle [duplicate]
This question already has an answer here: How can I combine multiple rows into a comma-delimited list in Oracle? [duplicate] 11 answers I have a table named "person". It contains person's id and it's parent id (only one parent is possible). As a result of a query, I want a table with first column - a person id, and a second column - a list of it's children id's. How exactly to do this? I've read about listagg function, but I'm not sure if it is appropriate for my purpose. And this query produces an empty second column: select t1.id, (select t2.id from person t2 where t2.parent_id = t1.id) from