So I have a database table that looks like -
MemberId LinkedMemberId
1 1
2 1
3 1
4 2
5 4
6 4
And I want to build a table value function where I can pass in 1, 2, 3, 4, 5 or 6 and it will return all of the values because they are linked.
Example -
I pass in 4, so I want 2, my LinkedMemberId
. Now because I have 2, I also want the LinkedMemberId
of 1. And now because I have 1, I also want the MemberIds
associated with LinkedMemberId
of 1.
Is there already an algorithm to get this kind of data?