Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

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)
0
OGSan
Asked:
OGSan
  • 2
1 Solution
 
eantarCommented:
Your query should be a link between the main and the dependant tables, yes? if so, in your query designer, drag the field that says Union or Management from the main table and you'll get the results you're looking for.

Let me know if you need more.

E
0
 
eantarCommented:
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
0
 
OGSanAuthor Commented:
Thanks, eantar!  Sometimes I get caught up in heads-down activity that I don't see the forest for the trees.  Building an intermediate set of results will work for me.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now