I would like to create a SQL for query that combines the data from 3 different tables/query..
The query will group them based on the Employee ID.
There are 3 tables and 1 query in this SQL.
Table 1 is a list of Employee IDs.
Table 2 has these fields:
Employee ID
Dept Name
Dept Type
Dept Group Dept Status
Person's Name
Person's Status
Person's Region
Account Number
Commission Date
Expenses Aug-12
Expenses Sept-12
Expenses Oct-12
....
Last Field will always be named "Total of Expenses"
Table 3 has these fields:
Employee ID
Last Name
First Name
Date
Division
Title
Company
Region
Customers
Bonus Plan
....
Last field will always be named "Account String"
Query will have these fields:
Employee ID
Currency
SumOfSalary
SumOfDebt
SumOfDeferred
...
Last field will always be named "SumOfTotal"
I would like to create a "join properties" that would include all employee ids in Table 1 and include those records from the other tables where joined fields are equal...
Then I would like to group them based on the employee ids in Table 1 and ONLY pull the data starting from those that are underlined above until the last field.
So I would only like to pull data from "Commission Date" field until "Total of Expenses" field in Table 2
I would only like to pull data from "Bonus Plan" field until "Account String" field in Table 3
The names of the fields between "Commission Date" and "Total of Expenses" fields will vary... The number of fields between the 2 fields will also vary. This applies to Table 2 and the Query too..
What will be the SQL of this?
Thanks!
Bookmarks