I need to group by a series of nested relationships. Use the following example. Assuming each persons name is unique to the database.
Person | Sibling 1 | Sibling 2
-------+-----------+-----------
Jason | Brad | Sheri
Brad | Sheri | Jason
Sheri | Brad | Tina
Tina | Sheri | Sam
Sam | Kara | Tina
Kara | Sam | Tina
James | Kelly | NULL
Kelly | James | NULL
Fred | NULL | NULL
How would I write the query to get this result?
Person | Family
-------+--------
Jason | 1
Brad | 1
Sheri | 1
Tina | 1
Sam | 1
Kara | 1
James | 2
Kelly | 2
Fred | 3
Ideally with out the use of external code such as CLR or CTEs.
EDIT: The following output is also acceptable.
Family | Siblings
-------+-------------------------------------
1 | Jason, Brad, Sheri, Tina, Sam, Kara
2 | James, Kelly
3 | Fred