CharlieMike73
Programmer
Hi,
I need to do some selective matching from two tables and add tthe result to a third (X-Ref) Table
For example - We have the following Tables:
Material
Unit
X-Ref_Unit_Material
In the Material Table we have over 100 different materials.
In the Unit Table we have over 500 units/crews.
Some units do construction, so do maintenance, some do sign post errecting, and others do other activities...
For example:
As you can see from the X-Ref Table above not all Units need to be associated with each material. ie a sign crew does not need steel bar.
So now that you have an idea what I am working with, here is what I need to do, I need to have some kind of script that can step through each material and see what units need a ref to it and append the new entries to the X-Ref_Material_Unit table.
Some crews/units may already have some of the materials already associated to them so I need something that checks if the material is already linked to that unit also, and if not then adds it.
I have a list of what Unit Type would need what material (in Paper Form), but before I enter it into the computer I wanted to see if anybody could help with this. Otherwise I will have thousands of records that I have to enter one by one.
Unfortunatly I do not have control over the design of the tables as they are part of a grander 140 table database.
PLEASE HELP!
If you dont understand, or have more questions about this problem PLEASE PLEASE contact me, this is a very important and urgent matter and I dont have the time to enter them all manually.
email me at charles.mcgrotty@state.me.us
Regards,
Charles McGrotty
I need to do some selective matching from two tables and add tthe result to a third (X-Ref) Table
For example - We have the following Tables:
Material
Unit
X-Ref_Unit_Material
In the Material Table we have over 100 different materials.
In the Unit Table we have over 500 units/crews.
Some units do construction, so do maintenance, some do sign post errecting, and others do other activities...
For example:
Code:
Material Table
| Mat_ID | Description |
|--------|-------------|
| 1 | Steel Bar |
| 2 | Crack Seal |
| 3 | Sign Post |
| 4 | Ditch Liner |
| 5 | Concrete |
| 6 | Sand |
| 7 | Signs |
...
Unit Table
| Unit_ID | Description | Type |
|---------|---------------------|-------|
| 1 | Construction Crew 1 | Const |
| 2 | Sign Crew 1 | Sign |
| 3 | Construction Crew 2 | Const |
| 4 | Maintenance Crew 1 | Maint |
| 5 | Sign Crew 2 | Sign |
| 6 | Maintenance Crew 2 | Maint |
| 7 | Maintenance Crew 3 | Maint |
...
X-Ref_Unit_Material Table
| Mat_ID | Unit_ID |
|--------|---------|
| 1 | 1 |
| 1 | 3 |
| 2 | 4 |
| 2 | 6 |
| 2 | 7 |
| 3 | 1 |
| 3 | 2 |
| 3 | 3 |
| 3 | 4 |
| 3 | 5 |
| 3 | 6 |
| 3 | 7 |
| 4 | 1 |
| 4 | 3 |
| 4 | 4 |
| 4 | 6 |
...
As you can see from the X-Ref Table above not all Units need to be associated with each material. ie a sign crew does not need steel bar.
So now that you have an idea what I am working with, here is what I need to do, I need to have some kind of script that can step through each material and see what units need a ref to it and append the new entries to the X-Ref_Material_Unit table.
Some crews/units may already have some of the materials already associated to them so I need something that checks if the material is already linked to that unit also, and if not then adds it.
I have a list of what Unit Type would need what material (in Paper Form), but before I enter it into the computer I wanted to see if anybody could help with this. Otherwise I will have thousands of records that I have to enter one by one.
Unfortunatly I do not have control over the design of the tables as they are part of a grander 140 table database.
PLEASE HELP!
If you dont understand, or have more questions about this problem PLEASE PLEASE contact me, this is a very important and urgent matter and I dont have the time to enter them all manually.
email me at charles.mcgrotty@state.me.us
Regards,
Charles McGrotty