Jump to content
TNG Community
Sign in to follow this  

Reports needed for multiple/incorrect parent/children entries

Recommended Posts


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.

Share this post

Link to post
Share on other sites

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.birthdatetr
FROM /*adds the mothers personID*/(

SELECT ind.personID, ind.gedcom, ind.famc, ind.lastname, ind.firstname, ind.birthdatetr, fam.wife
FROM /*gets everyone in the children table*/(

SELECT children.personID, children.gedcom, people.famc, people.lastname, people.firstname, people.birthdatetr
FROM tng_children AS children, tng_people AS people
WHERE children.personID = people.personID && children.gedcom = 'Flint' && people.gedcom = 'yourtree'
) AS ind, tng_families AS fam
WHERE fam.familyID = ind.famc && fam.gedcom = 'yourtree'
) AS ext, tng_people AS people
WHERE 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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this