T
tunafish62
If you have a People table and a relationship table relating people
together, by assigning one person as the main (i.e. parent) and all
others as the related (i.e. children), how do you construct a query
that will return the People records of both the parent and all the
children based on the parent ID? I am thinking it is a simple UNION
query but am getting stuck on the syntax.
For example:
tblPeople.PK_ID
tblPeople.FirstName
tblPeople.MiddleName
tblPeople.LastName
tblPeople.Birthday
tblPeopleGroups.PK_ID
tblPeopleGroups.MainPersonID (one to...)
tblPeopleGroups.RelatedPersonID (many relationship)
Given a known MainPersonID, I want to a query that returns all fields
in tblPeople of the Main Person plus all Related Persons -- if there
are no related person, the query should return just the tblPeople
record of the Main Person.
P.S. This is not the real issue but simple analogy of the problem I am
trying to solve -- just trying the baby steps method!
Thanks!
together, by assigning one person as the main (i.e. parent) and all
others as the related (i.e. children), how do you construct a query
that will return the People records of both the parent and all the
children based on the parent ID? I am thinking it is a simple UNION
query but am getting stuck on the syntax.
For example:
tblPeople.PK_ID
tblPeople.FirstName
tblPeople.MiddleName
tblPeople.LastName
tblPeople.Birthday
tblPeopleGroups.PK_ID
tblPeopleGroups.MainPersonID (one to...)
tblPeopleGroups.RelatedPersonID (many relationship)
Given a known MainPersonID, I want to a query that returns all fields
in tblPeople of the Main Person plus all Related Persons -- if there
are no related person, the query should return just the tblPeople
record of the Main Person.
P.S. This is not the real issue but simple analogy of the problem I am
trying to solve -- just trying the baby steps method!
Thanks!