Query Help, Please

From: Jerry Davidson <jerry_davidson_at_compuserve.com>
Date: Mon, 31 Dec 2001 08:57:26 -0600
Message-ID: <3C307CD6.402_at_compuserve.com>


I've got a query I need that is a little over my head. Any pointers would be greatly helpful.

I want to populate a table based on two other tables. The problem is the values in those tables are reliant on two other tables.

USASite_Access
   SA_S_ID
   SA_C_ID

USAStation

   S_ID
   S_Name

USAContractor

   C_ID
   C_Lname
   C_Fname

Station

   S_ID
   S_Name

Contractor

   C_ID
   C_Lname
   C_Fname

Site_Access

   C_ID (Either C_ID or E_ID)
   S_ID

Personell

   E_ID

In psuedo-code it would be like this:

insert into USASite_Access
the ids from the two USA tables
so that the old site_access table information is converted to the new IDs found on the USA tables.

So a match is found on the old site_access table to the old station table where the name is matched to the new USAStation table as one input.

A match is found on the old site_Access table to the old contractor table where the name is matched to the new USAContractor table as part of the other input. The rest of this is the match from the site_access table to the personnel table where a match causes the employee number to be used as the second input.

Should this be one query or multiple?

TIA,
Jerry Received on Mon Dec 31 2001 - 15:57:26 CET

Original text of this message