Hemsearch Posted February 5, 2008 Report Share Posted February 5, 2008 My database has 25 members working on it and it is natural that errors creep in with linking people together. After two recent sets of errors being discovered I’d like to create the following reports so that I can find where corrections are needed.1 A report listing children whose mother was under the age of 18 at the birth (I found one woman who was supposedly mother to nine people born up to 200 years before she was).2 A report listing people who apparently had two or more sets of parents.Can anyone advise me how to do these. Quote Link to comment Share on other sites More sharing options...
nimebe Posted February 6, 2008 Report Share Posted February 6, 2008 This is my absolute first attempt at subqueries, but I think this will show mothers under 18 years older than their children:SELECT ext.personID, ext.gedcom, ext.famc, ext.lastname, ext.firstname, ext.birthdatetrFROM /*adds the mothers personID*/(SELECT ind.personID, ind.gedcom, ind.famc, ind.lastname, ind.firstname, ind.birthdatetr, fam.wifeFROM /*gets everyone in the children table*/(SELECT children.personID, children.gedcom, people.famc, people.lastname, people.firstname, people.birthdatetrFROM tng_children AS children, tng_people AS peopleWHERE children.personID = people.personID && children.gedcom = 'Flint' && people.gedcom = 'yourtree') AS ind, tng_families AS famWHERE fam.familyID = ind.famc && fam.gedcom = 'yourtree') AS ext, tng_people AS peopleWHERE people.personID = ext.wife && people.gedcom = 'yourtree' && year( ext.birthdatetr ) < ( year( people.birthdatetr ) +18 ) && ext.birthdatetr != ( 0000 -00 -00 ) && people.birthdatetr != ( 0000 -00 -00 ) You'll need to change the 3 'yourtree' entries to the name of your tree. the +18 can be changed to look for mothers that are a different age range. Note that this query only checks for 18 years from the year of birth, not the exact date.If any of you SQL experts have something better, please let us know. 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.