Jump to content
TNG Community
JackM375

Report: Orphaned families

Recommended Posts

JackM375

When I try to save this Report I get an error:

Forbidden

You don't have permission to access /genealogy/admin_addreport.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Code:

SELECT familyid, husband AS husbandPersonID, wife AS WifePersonID, marrdate, living, gedcom FROM tng_families WHERE husband="" AND wife="" ORDER BY CAST(SUBSTRING(familyID, 2) AS UNSIGNED)

Share this post


Link to post
Share on other sites
Hiraeth

When I try to save this Report I get an error:

Forbidden

You don't have permission to access /genealogy/admin_addreport.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Code:

SELECT familyid, husband AS husbandPersonID, wife AS WifePersonID, marrdate, living, gedcom FROM tng_families WHERE husband="" AND wife="" ORDER BY CAST(SUBSTRING(familyID, 2) AS UNSIGNED)

Not sure what you were trying to do as I would think you should be looking for children with no parents (i.e. not assigned to a family). Try this for locating such children:

SELECT p.personID, p.lastname, p.firstname, p.birthdate, p.living, p.gedcom, p.changedate FROM tng_people AS p LEFT OUTER JOIN tng_children AS c ON ( p.personID = c.personID AND p.gedcom = c.gedcom ) LEFT OUTER JOIN tng_families AS f1 ON ( p.personID = f1.husband AND p.gedcom = f1.gedcom ) LEFT OUTER JOIN tng_families AS f2 ON ( p.personID = f2.wife AND p.gedcom = f2.gedcom ) WHERE c.personID IS NULL AND f1.husband IS NULL AND f1.wife IS NULL AND f2.husband IS NULL AND f2.wife IS NULL ORDER BY p.changedate, p.lastname, p.firstname, p.birthdate DESC; 

Share this post


Link to post
Share on other sites
JackM375

Not sure what you were trying to do as I would think you should be looking for children with no parents (i.e. not assigned to a family). Try this for locating such children:

SELECT p.personID, p.lastname, p.firstname, p.birthdate, p.living, p.gedcom, p.changedate FROM tng_people AS p LEFT OUTER JOIN tng_children AS c ON ( p.personID = c.personID AND p.gedcom = c.gedcom ) LEFT OUTER JOIN tng_families AS f1 ON ( p.personID = f1.husband AND p.gedcom = f1.gedcom ) LEFT OUTER JOIN tng_families AS f2 ON ( p.personID = f2.wife AND p.gedcom = f2.gedcom ) WHERE c.personID IS NULL AND f1.husband IS NULL AND f1.wife IS NULL AND f2.husband IS NULL AND f2.wife IS NULL ORDER BY p.changedate, p.lastname, p.firstname, p.birthdate DESC; 

Thanks Graham that will work for me.

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

×