Q: Parent <> child tree structure with unique child id's by means of recursive SQL query I have data like this:


*

*Parent name | Child name

*parent_A    |child_1

*parent_A    |child_2

*parent_B    |child_1


the data is intended to be displayed in Telerik self-referencing hierarchy datagridview component which requires each parent <> child combination is unique. notice child_1 is child of parents parent_A and parent_B (my example is very simplified, just for presentation, real ones consists of many levels and leafs)
.
Then the result needs to be as follow:


*

*Parent name | Child name |Child unique ID

*parent_A    |child_1     |1

*parent_A    |child_2     |2

*parent_B    |child_1     |3


Is there a way to achieve this with a recursive query?
I tried to achieve the result with interface procedure but it takes too long to use it.
Thanks for any clues.

A: This is not an answer to the question but I am trying to illustrate the problem, and the way you need the data structured to achieve what you are after:

