Living family flag

From TNG_Wiki
Jump to navigation Jump to search

Sometimes families are flagged as living while the spouses are both dead, this query will change that.

  1. The following will create a View of families flagged living with both spouses flagged as not living i.e dead:
  2. Once created the View can be "viewed/browsed" just like a table so you can check the results.
  3. Then update the tng_families table using the results returned in the created View :
  4. Then delete the created View from the database when done:

Copy and paste the text between the lines into the MySQL section of your MySQL admin, IMPORTANT: Make a backup before you try anything and use this at your own risk!

CREATE VIEW famliving AS SELECT h.lastname as fName, concat(h.title, ' ', h.firstname, ' ', h.suffix) AS hfName, f.marrdate, w.lastname AS wfName, concat(w.title, ' ', w.firstname, ' ', w.suffix) AS wlName, f.familyID as FamilyID FROM tng_families f INNER JOIN tng_people h on f.gedcom = h.gedcom and f.husband = h.personID INNER JOIN tng_people w on f.gedcom = w.gedcom and f.wife = w.personID WHERE = "1" AND = "0" AND = "0" ORDER BY f.marrdatetr;
UPDATE tng_families f, famliving fl SET = "0" WHERE f.familyID = fl.familyID;
DROP VIEW famliving;