Question : Query logic

Hi, Experts -
I have a query that is appending rows to an empty table - and uses as input a file containing one row for each employee in our company.  
Following each employee row is could be:
-  One-or-more rows of dependents
-  Another employee row.
The query is currently reading each row of input, and creating one row of (reformatted) output.  However, for each dependent row of output - I need to include a value that only resides on the associated employee row.  In the sample below, the value is either "Union" or "Mgmt."  I need to transfer this onto the associated Dependent rows.  How can I do this in my query?

Sample input:  EE=employee row  DE = dependent row
EE   Union   Joe Smith
EE   Mgmt    John Davies
DE               Sally Davies
DE               John Davies, Jr.
EE   Mgmt    Billy Bob Jefferson
(...and so on.)

Resulting output (desired):
EE   Union   Joe Smith
EE   Mgmt    John Davies
DE   Mgmt    Sally Davies
DE   Mgmt    John Davies, Jr.
EE   Mgmt    Billy Bob Jefferson
(...and so on)

Answer : Query logic

If you're working with a single table that has both the Employees and the dependants, create two queries one for ONLY EE records, and one for ONLY DE employees. Make sure that there is an employee ID in both queries. Then create a third query to link the employees to the dependents. And drag the UnionManagement field from the Employees query.

E
Random Solutions  
 
programming4us programming4us