How Can I do this??
Posted
by ramadan2050
on Stack Overflow
See other posts from Stack Overflow
or by ramadan2050
Published on 2010-04-27T11:47:08Z
Indexed on
2010/04/27
11:53 UTC
Read the original article
Hit count: 312
I have a table records(ID, ParentID)
containg this data
ID ParentID
1 null
2 1
3 2
3 4
4 5
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
© Stack Overflow or respective owner