Report: All the men in the database sorted on first name

From TNG_Wiki
Jump to navigation Jump to search

Description: All the men in the database sorted on first 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 tng_people.living, tng_people.private, lnprefix, prefix, suffix, 
tng_people.branch,firstname, lastname,title,(if(sex='M',families1.wife,families2.husband)) 
as spouse,(if(sex='M',families1.wife,families2.husband)) 
as spouse,birthdate,birthplace,if(sex='M',families1.marrdate,families2.marrdate),
if(sex='M',families1.marrplace,families2.marrplace),deathdate,deathplace, tng_people.personID, tng_people.gedcom, nameorder 
FROM (tng_people ) 
LEFT JOIN tng_families AS families1 ON (tng_people.gedcom = families1.gedcom 
AND tng_people.personID = families1.husband ) LEFT JOIN tng_families 
AS families2 ON (tng_people.gedcom = families2.gedcom AND tng_people.personID = families2.wife ) 
WHERE (sex LIKE "M%") AND tng_people.gedcom = "savenije" ORDER BY firstname,lastname,birthdate