Works great, how about if i wanted to list the parent ID rows too with the current output and what if the child node was a parent to another child? For EG:
999, NULL, 'Corp.'
998, 999, 'Div1',
997, 999, 'Div2',
510, 998, 'Child Div1A',
110, 997, 'Child Div2A',
991, 510, 'Child5,
990, 110, 'Child4',
580, 510, 'Child1',
250, 510, 'Child2',
190, 110, 'Child3'
So, for example, if given 999, I would return 998, 997, 510, 110, 990, 991, 580,250,190. But given 997, I would return only 110, 990, 190. If given 110, 990, 190 and if given 190 then just 190