Query with Relationships not working

S

shm135

I have the following query:

SELECT [All Contract Pricing].*, [Contract].Speed
FROM [Contract]
INNER JOIN [All Contract Pricing] ON ([Contract].ID = [All Contract
Pricing].ID) AND ([Contract].Category = [All Contract
Pricing].Category);

Here is what I want to do:
The ID and Category fields in both the [Contract] and [All Contract
Pricing] tables match. I am trying to add the [Speed] field from the
[Contract] table to the [All Contract Pricing] table.

This is the problem:
The [All Contract Pricing] table has 48000 records, so the results of
the query should also have 48000 records. I want all the records from
the [All Contract Pricing] table and only the [Speed] field added to
it, based on the [ID] and [Category] of each record. However, it keeps
coming back with 250,000+ records.

Any ideas? Thanks!!
 
J

John W. Vinson

I have the following query:

SELECT [All Contract Pricing].*, [Contract].Speed
FROM [Contract]
INNER JOIN [All Contract Pricing] ON ([Contract].ID = [All Contract
Pricing].ID) AND ([Contract].Category = [All Contract
Pricing].Category);

Here is what I want to do:
The ID and Category fields in both the [Contract] and [All Contract
Pricing] tables match. I am trying to add the [Speed] field from the
[Contract] table to the [All Contract Pricing] table.

This is the problem:
The [All Contract Pricing] table has 48000 records, so the results of
the query should also have 48000 records. I want all the records from
the [All Contract Pricing] table and only the [Speed] field added to
it, based on the [ID] and [Category] of each record. However, it keeps
coming back with 250,000+ records.

Any ideas? Thanks!!

The query will only have 48000 records if [Contract] also has 48000 records
with matching ID and Category values. If Contract has 250000 records that
match then... you'll get 250000 records in the query.

What is the Primary Key of each table? Is the combination of ID and Category
unique? or is just ID unique by itself? If so, in which table? What
relationships (if any) have been defined between the tables?
 

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