Searching for data by a daughter table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone,

I'm having trouble figuring out how to get a query that returns records from
a mother table, based on search criteria on a daugther table. The tables are
linked with a one to many relationship.

When I add the fields I want to search from the daughter table and the
fields I want to display from the mother table, the query output shows me
duplicates (or triplicates, etc.) whenever there's more than one linked
record on the daughter table. I'd like the query to return just one row per
mother table record. Is there any way to do this?

Any ideas will help a lot. Thanks!!

Natalia
 
Hello everyone,

I'm having trouble figuring out how to get a query that returns records from
a mother table, based on search criteria on a daugther table. The tables are
linked with a one to many relationship.

When I add the fields I want to search from the daughter table and the
fields I want to display from the mother table, the query output shows me
duplicates (or triplicates, etc.) whenever there's more than one linked
record on the daughter table. I'd like the query to return just one row per
mother table record. Is there any way to do this?

Any ideas will help a lot. Thanks!!

Natalia

An IN clause is useful in this case:

SELECT <whatever> FROM MotherTable
WHERE PrimaryKey IN(SELECT ForeignKey FROM DaughterTable
WHERE <criteria>)

using the appropriate fieldnames and tablenames of course.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top