Report: Families: individuals with missing father or missing mother

From TNG_Wiki
Jump to navigation Jump to search

Description: Families: individuals with missing father or missing mother

Copy and paste the text between the lines into the reports section below "OR Leave Display, Criteria and Sort fields blank and enter direct SQL SELECT statement here:" and give it the title you think is appropriate


SELECT p.personID, p.lastname, p.firstname, p.birthdate, p.living, father.personID 
AS FatherNr, father.lastname AS Name1, father.firstname AS Firstname1, 
father.living, mother.personID AS MotherNr, mother.lastname AS Name2, 
mother.firstname AS Firstname2, mother.living, p.gedcom 
FROM tng_children AS c LEFT JOIN tng_families AS f ON (c.familyID=f.familyID AND c.gedcom=f.gedcom) 
LEFT JOIN tng_people AS p ON (c.personID=p.personID AND c.gedcom=p.gedcom) 
LEFT JOIN tng_people AS mother ON (f.wife=mother.personID AND f.gedcom=mother.gedcom) 
LEFT JOIN tng_people AS father ON (f.husband=father.personID AND f.gedcom=father.gedcom) 
WHERE f.husband="" OR f.wife="" 
ORDER BY p.lastname, p.firstname, p.birthdate