Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 TABLE RELATIONSHIPS

Author  Topic 

mary H
Starting Member

32 Posts

Posted - 2008-10-15 : 21:55:46
I have two tables products and orders. Product table has product_id field and order table has product_id field.


Both of the product_id fields have duplicate records so i couldnt add a primary key to the product_id field in the products table..


I indexed both product_id fields in the 2 tables to allow duplicates.


Im trying to create a one-to-many relationship for the product_id in the product table and product_id in the order table.


When i try to create the relationship i get an error msg "No unique index found for the referenced field of the primary table".


How can i create the relationship if both fields contain duplicate rows??

Any help would be appreciated!!

obiron
Starting Member

23 Posts

Posted - 2008-11-03 : 09:55:21
You can't

If I asked you to get me a Mars bar, how would you know whether I wanted a normal one or a king size unless I gave you the product code.

You must find some unique match. You may be able to do it defacto based on product code and price and/or description but you really need to look at normalising the data to make your joins simple.

Obiron
Go to Top of Page
   

- Advertisement -