Report: Branches with associated families, ordered by husband's last name

From TNG_Wiki
Jump to navigation Jump to search

Description: Branches with associated families, ordered by husband's last name

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 bl.branch, b.description AS Branche_description, f.familyID, h.personID AS Person1, h.lastname 
AS last_name1, h.living, h.firstname AS first_name1, w.personID AS Person2, w.lastname 
AS last_name2, w.firstname AS first_name2, w.living FROM tng_branchelinks AS bl
INNER JOIN tng_branches AS b ON (bl.branch=b.branch AND bl.gedcom=b.gedcom)
INNER JOIN tng_families AS f ON (bl.persfamID=f.familyID AND bl.gedcom=f.gedcom)
INNER JOIN tng_people AS h ON (f.husband=h.personID AND f.gedcom=h.gedcom)
INNER JOIN tng_people AS w ON (f.wife=w.personID AND f.gedcom=w.gedcom)
ORDER BY h.lastname, h.firstname, h.birthdatetr;