I want to write a select query to get the complete path from child to parent as:
| Unique Id | Child Code | Parent Code |
| X | 9 | 7 |
| Y | 7 | 6 |
| Z | 6 | 5 |
| A | 5 | NULL |
| B | 11 | 33 |
| C | 33 | 22 |
| D | 22 | NULL |
if code selected is 9 then query should return its all the parents as result which are : 9-7-6-5....
and if code selected is 11 then query should return: 11-33-22....
Thanks.