Report: Multiple births (even when born on different days)

From TNG_Wiki
Jump to navigation Jump to search

Description: Similar to the twins and triplets. Only it also traces twins and triplets born on different days.

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 concat( p.firstname, ' ', if( length( p.nickname ) , concat( '"', p.nickname, '" ' ) , ' ' ) , if( length( p.lnprefix ) , concat( p.lnprefix, ' ' ) , ' ' ) , p.lastname, if( length( p.suffix ) , concat( ', ', p.suffix, ' ' ) , ' ' ) ) AS name, birthdate, p.famc FROM (

SELECT gedcom, famc, birthdatetr FROM ( (

SELECT gedcom, famc, birthdatetr FROM `tng_people` WHERE day( birthdatetr ) AND length( famc ) ) UNION ALL (

SELECT gedcom, famc, birthdatetr - INTERVAL 1 DAY FROM `tng_people` WHERE day( birthdatetr ) AND length( famc ) ) UNION ALL (

SELECT gedcom, famc, birthdatetr - INTERVAL -1 DAY FROM `tng_people` WHERE day( birthdatetr ) AND length( famc ) ) ) AS bd GROUP BY gedcom, famc, birthdatetr HAVING count( * ) >1 ) AS twins JOIN tng_people AS p USING ( gedcom, birthdatetr, famc ) ORDER BY lastname, p.birthdatetr, firstname