Given the one-table design given below how would the following best be queried
- The set of extended family members given a folk id
- The set of common ancestors given two folk ids
- The set of descendants given a folk id
*Bonus 1st cousins, twice removed given a folk id
Table Folk
FolkID (PK) MotherID (FK to folkid) FatherID (FK to folkid) Name Gender
Someone has to build a familytree application? I did something similar some time ago, using XML and XPath:
String XPath=’child::*/child::Person[child::Father[@ID=\”+String(ID) +’\’] and child::Mother[@ID=\”+String(Spouse)+’\’]]’; etc.