获取特定孩子的“合并”树路径

I've got a filter page where I retrieve certain children from a directorytree (through a filter).

These children are all underneath a certain parent.

So, say I have this structure:

  • parentDirectory1
    • subDirectory1
      1. child1
      2. child2
    • subDirectory2
      1. child3
      2. child4
  • parentDirectory2
    • ...

Through the filter I know two things: (e.g.) - all the children i need are under parentDirectory1 - the children are child1, child3, and child4.

I could perform a "path"-query from every child up to the parent, but I would like a "merged" hierarchical result, like so:

  • parentDirectory1
    • subDirectory1
      1. child1
    • subDirectory2
      1. child3
      2. child4

so NOT this:

  • parentDirectory1
    • subDirectory1
      1. child1
    • subDirectory2
      1. child3
    • subDirectory2
      1. child4

I have the common fields available in my sql table: id, parentId, left, right, and level. Does anyone have a clue how I should approach this?

My apologies for the strange numbering, SO is changing it to those numbered lists :-)