I have a lookup table with parent and child relation.It has a list of tables with parent and child relationship along with the keys to join.I need to create a function to pull the data recursively from the parent and child tables using a dynamic query.In the given example data has to be pulled from all three tables and displayed hierarchically starting from HR.There could be any number of child records.Please help.
Table Parent PK Parent_PK
HR Id
Department HR Deptid Id
Emp Department Depid depid
<?ml version="1.0"?>
<HR>
<Department>
<Emp>
</Emp>
<Department>
</Hr>