RickM Posted October 29, 2020 Report Share Posted October 29, 2020 Am definitely not great with mysql, I will get there I'm sure.. This report was one of the pack that came off the Wiki page It currently shows length of marriage for those people deceased (both parties) and those divorced (living or deceased) I would like to have the report show ALL marriage lengths both fore living and deceased. Would one of the msql experts be able to point me in the right direction please.. Many Thanks in advance.. select CONCAT('<a href = \"familygroup.php?familyID=', F1.familyID, '&tree=', F1.gedcom, '\" target=\"_blank\" class=\"fam\">', F1.familyID, '</a>') as FamilyID , IF(F1.living=0, "Deceased", "Alive") as Status ,CONCAT(P1.lastname, ', ', P1.firstname) as HusbandName ,CONCAT(P2.lastname, ', ', P2.firstname) as WifeName ,case when YEAR(F1.divdatetr) != 0 then YEAR(F1.divdatetr)-YEAR(F1.marrdatetr) when YEAR(P1.deathdatetr) != 0 and YEAR(P2.deathdatetr) != 0 and YEAR(P1.deathdatetr) <= YEAR(P2.deathdatetr) then YEAR(P1.deathdatetr)-YEAR(F1.marrdatetr) when YEAR(P1.deathdatetr) != 0 and YEAR(P2.deathdatetr) != 0 and YEAR(P1.deathdatetr) > YEAR(P2.deathdatetr) then YEAR(P2.deathdatetr)-YEAR(F1.marrdatetr) else 0 end as YearsMarried ,F1.marrdate ,F1.divdate ,P1.deathdate as HusbandDeathDate ,P2.deathdate as WifeDeathDate ,case when YEAR(F1.divdatetr) != 0 or (YEAR(P1.deathdatetr) != 0 and YEAR(P2.deathdatetr) != 0) then ' ' when YEAR(P1.deathdatetr) = 0 then 'Husband death date not known' when YEAR(P2.deathdatetr) = 0 then 'Wife death date not known' end as Comment from tng_families F1 inner join tng_people P1 on F1.gedcom = P1.gedcom and F1.husband = P1.personID inner join tng_people P2 on F1.gedcom = P2.gedcom and F1.wife = P2.personID where F1.marrdate != '' and UPPER(P1.deathdate) not like 'ABT%' and UPPER(P1.deathdate) not like 'AFT%' and UPPER(P1.deathdate) not like 'BEF%' and UPPER(P1.deathdate) not like 'BET%' and UPPER(P1.deathdate) not like 'CAL%' and UPPER(P1.deathdate) not like 'CIRCA%' and UPPER(P1.deathdate) not like 'EST%' and UPPER(P2.deathdate) not like 'ABT%' and UPPER(P2.deathdate) not like 'AFT%' and UPPER(P2.deathdate) not like 'BEF%' and UPPER(P2.deathdate) not like 'BET%' and UPPER(P2.deathdate) not like 'CAL%' and UPPER(P2.deathdate) not like 'CIRCA%' and UPPER(P2.deathdate) not like 'EST%' and UPPER(F1.marrdate) not like 'ABT%' and UPPER(F1.marrdate) not like 'AFT%' and UPPER(F1.marrdate) not like 'BEF%' and UPPER(F1.marrdate) not like 'BET%' and UPPER(F1.marrdate) not like 'CAL%' and UPPER(F1.marrdate) not like 'CIRCA%' and UPPER(F1.marrdate) not like 'EST%' and UPPER(F1.marrdate) != 'Y' and UPPER(F1.divdate) not like 'ABT%' and UPPER(F1.divdate) not like 'AFT%' and UPPER(F1.divdate) not like 'BEF%' and UPPER(F1.divdate) not like 'BET%' and UPPER(F1.divdate) not like 'CAL%' and UPPER(F1.divdate) not like 'CIRCA%' and UPPER(F1.divdate) not like 'EST%' and UPPER(F1.divdate) != 'Y' and (F1.divdate != '' or P1.deathdate != '' or P2.deathdate != '') and not (YEAR(F1.divdatetr) = 0 and YEAR(P1.deathdatetr) = 0 and YEAR(P2.deathdatetr) = 0) having Comment = '' order by P1.lastname, YearsMarried desc, F1.marrdatetr desc ; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.