Jump to content
TNG Community

Report need to limit results to BRANCH of user logged in


jayat1familytree

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

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...