Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 HELP PLEASE!!!

Author  Topic 

stalian4002
Starting Member

3 Posts

Posted - 2008-12-23 : 19:24:02
i am making a program to store family tree one thats similar GEDCOM format. can anyone help me write a sql query to get all the relatives and determine the relation for example when the user p

(fathers mother, brothers wife, cousins etc) for a particular user.



here are the tables i have please let me know if i need more tables as my sql is not very good at

Table Users
-UserName (PK)
-FirstName
-AsChildInFamilyID
-AsSpouseInFamilyID
-AsParentInFamilyID

Table Families
- FamilyID (PK)
- MarriageDate

Table FamilyMembers
- FamilyMemberID (PK)
- FamilyID (FK)
- UserName


visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-25 : 01:42:34
have a look at recursive CTEs in books online.
Go to Top of Page
   

- Advertisement -