Jump to content
TNG Community
Sign in to follow this  
jayat1familytree

Report need to limit results to BRANCH of user logged in

Recommended Posts

jayat1familytree

I have a report listing a person with their parents names.

BUT I need to have the result be only persons in the "Logged-in" users BRANCH.

And I am unsure how to find the correct SQL syntax to select only the branch.

 

 

tng_people.branch LIKE  "%tng_users.branch%"

 

If this cannot be done in the report generator, I am ok with creating a page link to run the report.

Thanks in advance for any help you can provide.

JAY

 

SELECT p.personID, p.lastname, p.firstname, p.birthdate, ch.ordernum, p.living,
father.personID AS FatherNr, father.lastname AS FatherLastName, father.firstname AS FatherFirstName, father.birthdate AS FatherBirthdate,
YEAR( p.birthdatetr ) - YEAR( father.birthdatetr ) AS Father_age,
mother.personID AS MotherNr, mother.lastname AS MotherLastName, mother.firstname AS MotherFirstName, mother.birthdate AS MotherBirthdate, YEAR( p.birthdatetr ) - YEAR( mother.birthdatetr ) AS Mother_age,
p.gedcom FROM tng_children AS ch LEFT JOIN tng_people AS p ON ( ch.personID = p.personID AND ch.gedcom = p.gedcom ) LEFT JOIN tng_families AS f ON ( ch.familyID = f.familyID AND ch.gedcom = f.gedcom )
LEFT JOIN tng_people AS father ON ( father.personID = f.husband AND father.gedcom = f.gedcom )
LEFT JOIN tng_people AS mother ON ( mother.personID = f.wife AND mother.gedcom = f.gedcom )
WHERE p.birthdatetr <> "0000-00-00" AND father.birthdatetr <> "0000-00-00" AND mother.birthdatetr <> "0000-00-00" AND p.birthdate NOT LIKE "Aft%" ORDER BY p.lastname, ch.familyID, p.birthdatetr

 

 

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  

×