In this table Ancestor records are the one where Parent_Id = 0
so if i write a sql statement, to get the ancestor record
select dept_id,dept_name,address,customer where Parent_Id =0
for e.g. the ouput of this query can be dept_id =101 and dept_name = commercial
now child records are also in the same table where Parent_id = 101
so the sql statement to get to the child records will be
select dept_id,dept_name where Parent_Id =101
output of this statement will be the children belonging to Parent_id 101.
How do i achieve this in QV where if user select a parent , he should get all the children belonging to the parent with attributes like address and customer.
if a parent does not have a child then attributes of Parent should be displayed.