mothra
08-08-2004, 06:24 AM
I'm working on setting up some tables and I'm at a loss on how to relate tables when I need to use more than 1 field as a foreign key. Here's a quick example:
Given that there is a "Vendors" table and a "Stores" table. There can be a one to many relationship because each vendor can have one or more store locations. So what I want to do is make the primary key of the Vendors table = "vendor_name" and the foreign keys in the "Stores" table = "vendor_name" AND "location" (which is just an integer, not unique in the table).
I can't figure out how to set this up in the table!?
Given that there is a "Vendors" table and a "Stores" table. There can be a one to many relationship because each vendor can have one or more store locations. So what I want to do is make the primary key of the Vendors table = "vendor_name" and the foreign keys in the "Stores" table = "vendor_name" AND "location" (which is just an integer, not unique in the table).
I can't figure out how to set this up in the table!?