jayat1familytree Posted October 21, 2017 Report Share Posted October 21, 2017 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 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.