tables with more than one primary key

rdeanh

New member
Local time
Today, 00:25
Joined
Aug 10, 2002
Messages
8
Could anyone help me? Within each order I have order details. Is there any way to start each order off with a new order detail 1 (i.e. order 1, ord det 1-5; order 2, ord det 1-7; etc.). Obviously, autonumber cannot be applied. Both the order and order detail are primary keys in the same table and I can't seem to find much info regarding tables with more than one primary key.
 
Why are you storing order details in the same table as the order master?

Create your OrdersMaster table (with it's primary key)

OrderID
OrderDate etc etc

Then create your OrderDetails table with its own primary key, and store the OrdersMaster key as one of the fields.

OrderDetailID
OrderID - Linked to OrderMaster Table
OrderDetail1 blah blah

You will have to establish the relationships for these tables.

One to many (every order can have many orderdetails)

This will allow you to have as many orderdetails per order as you wish.

HTH

Brad.
 

Users who are viewing this thread

Back
Top Bottom