My table has the following schema:
id, parent_id, text
Given the following data I would like to return an xml hierarchy:
Data: (1,null,'x'), (2,1,'y'), (3,1,'z'), (4,2,'a')
XML:
[row text="x"]
[row text="y"]
[row text="a"/]
[/row]
[row text="z"/]
[/row]
Added: the hierachy has no maximum depth