473,406 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Combination Primary Key

Thanks for your help with my switchboard question it was of great help. One more question I have to use access for this Uni project
one of my tables have a combination primary key how do I join it to another table. I’ve tried access help and my research books can't find a answer feel its quite simple would really be grateful for help. Have to make it combination as code and date both needed to make unique key the code already been given us
Nov 20 '06 #1
1 4450
MMcCarthy
14,534 Expert Mod 8TB
Thanks for your help with my switchboard question it was of great help. One more question I have to use access for this Uni project
one of my tables have a combination primary key how do I join it to another table. I’ve tried access help and my research books can't find a answer feel its quite simple would really be grateful for help. Have to make it combination as code and date both needed to make unique key the code already been given us
A double primary key is usually used when joining two tables with a many to many relationship.

e.g. tblCustomers and tblSuppliers

Customers have many Suppliers and Suppliers supply many Customers. This is known as a Many to Many relationship. In this case a join table is created tblCust_Supl. This table would have a double primary key CustID the primary key from tblCustomers and SuplID the primary key from tblSuppliers. This allows for tblCustomers to join tblCust_Supl and for tblCust_Supl to join to tblSuppliers. The reverse also of course.

Now if this is not the case with your design I would recommend Creating a new field ID (type Autonumber) to act as the Primary Key rather than the two fields you are currently using.

To follow your current path you would have to create a double join to two foreign keys in each of the tables you're trying to join to your main table and this is very bad design and should never be done without a very good reason.
Nov 20 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bo Xu | last post by:
Object of Combination By Bo Xu Introduction A combination of n things, taken s at a time, often referred as an s-combination out of n, is a way to select a subset of size s from a given set of...
7
by: Clifford Heath | last post by:
I have a case where a table has two candidate primary keys, but either (but not both) may be NULL. I don't want to store a copy of the concatenated ISNULL'ed fields as an additional column, though...
2
by: calan | last post by:
Having a brainfart.... I need a query that returns a record count, based on two distinct fields. For example: Order Revision Customer 001 1 Bob...
9
by: 101 | last post by:
Taking a course on SQL. They are saying you can get better performance by having multiple files for a group. They then graphically show an example of "Primary" with multiple data files. I have...
4
by: serge | last post by:
I ran into a table that is used a lot. Well less than 100,000 records. Maybe not a lot of records but i believe this table is used often. The table has 26 fields, 9 indexes but no Primary Key at...
2
by: S0ck3t | last post by:
Please could I have some help on matching records between tables. I want to return a check (true/false) stating whether the field combination in table 1 occurs in table 2. Obviously it's easy with...
0
by: Ben | last post by:
Hi, It's about a database containing (for simplifying) three fields: 'placenr' (primary key), 'place' and 'color'. The records are updatable (Edit/Update button) in a gridview. For updating the...
2
by: bubblegirl | last post by:
Hi, I need help in getting this database to work well (user-friendly) by generating auto client ID. The ID is NOT the auto number that Access automatically create when there is no primary key. ...
0
barbk
by: barbk | last post by:
Hey all, In DB2 v9 is it possible to have an auto generated number field within a primary key that is a combination of multiple fields? For example resv locn sale_no 1234 789...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.