query returns too few or too many results

  • Thread starter ionic-fire via AccessMonster.com
  • Start date
I

ionic-fire via AccessMonster.com

I have built a multi-table select query and right now all the relationships
between tables are the default "show each record in tblXXX for each record in
tblYYY".

When I run the query, I get only one record and it is repeated eight times.
If I start changing some of the table relationships to INNER JOIN's or OUTER
JOIN's, then I start getting the other records, but most of them are repeated
at least once. I do not have any additional data connected to these records,
so I am not sure why it is being displayed numerous times.

I must admit I do not fully understand all about JOINS and relationships yet
(I thought I did, but evidently I didnt). I would appreciate some direction
and perhaps a link to a tutorial on JOINS and Relationship types. Thank you.
 
J

John W. Vinson

I have built a multi-table select query and right now all the relationships
between tables are the default "show each record in tblXXX for each record in
tblYYY".

When I run the query, I get only one record and it is repeated eight times.
If I start changing some of the table relationships to INNER JOIN's or OUTER
JOIN's, then I start getting the other records, but most of them are repeated
at least once. I do not have any additional data connected to these records,
so I am not sure why it is being displayed numerous times.

Because there *are* multiple records.

If you have a record in TableA with a primary key value of 123, and there are
eight records in TableB with the value 123 in the field you're using as the
foreign key, then you will see the data from each of those eight records, in
conjunction with eight "copies" of the 123 record in the main table.

That's just how joins are designed to work.

What do you actually have in the table? Could you post the SQL of the query?
What do you *expect* to see?

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top