I have a table records(ID, ParentID)
containg this data
ID ParentID
1 null
2 1
3 2
4 2
5 3
6 null
7 6
If you draw this table in hierarchy as a family 1,2,3,4,5
will be related to each other.
I want to find a way, where I can pass an ID like 3 it give me the others family members using SQL or using C#
3 - result 1,2,4,5
2 - result 1,3,4,5
6 - result 7
and so on
I want to find my parent and his parents and childs and my child and his childs
LIKE THE EXAMPLES