I have table with below data.
id|child
1|2
1|3
1|4
2|6
2|7
3|9
6|10
6|11
17|18
19|20
18|19
I need to fetch the data like below. i.e super-parent to all child relationship for a id (say here 1 and 19).
Here I have select all child's recursively of super parent id "1"
id|all_child_id
1|2,3,4,6,7,9,10,11
Here I want to select all child's of super parent id '17'.
id|all_child_id
17|18,19,20
I am not aware how to write recursive queries in sql.
Please do not ask me to create intermediate table.