Table linking query

salamander

Registered User.
Local time
Yesterday, 16:49
Joined
Mar 3, 2008
Messages
18
Hi there,

The aim of this (as part of a bigger solution) is to create an entry system where users can enter jobs in, assign a resource to the job and give the resource a cost. The conditions are that resources can be on more than 1 job, more than 1 resource can be on a job.

Obviously entering in resources manually is not a good solutioon (eg having 20 resource fields) as it is now. I want to create a relation between tables to achieve something better.

Let's say I had (for illustration sake) 2 tables, one which is a list of people and one which is a list of jobs. I want to be able to assign a person to a job for x amount of time (defined by a start date and end date in the job table) at cost y.

So we could have a field for the people table which would relate to the job id and a field for rate in the job db. However, people can be on more than 1 job (eg after doing one they do another) and there can be multiple people on a job (having one field for rate rendering it useless)

How can this be done in the most efficient way so that any job could be looked at historically and have the relevant rates etc? Would I have to create another table with rates relating to the job ID and person ID? This would allow for multiple resources per job and to have a rate assigned for each resource.

eg if person ID = 1 and job id = 1 then fetch rate etc and display in a list, and to calculate total cost simply sum all rates where job id = 1?

Thanks
 
Okay, how I have done it is have 3 tables:

People, Jobs and AssignPeople.

AssignPeople is the "intermediary"; it gets a Person's ID and a Job ID, and can assign a rate.

Thus I can have multiple people per job, and people having more than one job.

Good way?
 
Yup, that's the way to model a many to many relationship in Access.
 
Excellent thanks. In reality, I have 6 tables that need to be linked centrally, so I will be using the same principle (having a central one I call "assign" so it can link all 6 easily)
 

Users who are viewing this thread

Back
Top Bottom