I like to do something like this:(build a tree from relationship)
I have a table like this
NODES__________________________________ParentID Varchar(20)ParentType varchar(20)ChildID varchar(20)ChildType
varchar(20)
__________________________________
What in the table'A1', 'A', 'B1', 'B''A2', 'A', 'B2', 'B''A1', 'A', 'B3', 'B''B1', 'B', 'C1', 'C''B1', 'B', 'C2',
'C''C1','C', 'D1', 'D''A1', 'A', 'B4', 'B' 'B1', 'B', 'C5', 'C'
----------------------------------
now I like to get all nodes with 'A1' as root
to get the result like this'A1', 'A', 'B1', 'B''B1', 'B', 'C1', 'C''C1', 'C', 'D1', 'D''B1', 'B', 'C2', 'C''B1', 'B',
'C5','C''A1', 'A', 'B3', 'B''A1', 'A', 'B4', 'B'
or I just like to get another tree start with 'B1'
like this'B1', 'B', 'C1', 'C''C1', 'C', 'D1', 'D''B1', 'B', 'C2', 'C''B1', 'B', 'C5', 'C'
How can i make it by sql , and sql functions
Thanks lot and regards.
Scott