padlocked17
Registered User.
- Local time
- Today, 10:35
- Joined
- Aug 29, 2007
- Messages
- 276
All,
Base Info:
AllEventsRaw Union Query
DualCredits Query
Desired Outcome (A Query with the following Column Headers)
SSAN
Task_ID
ACC_DT_FINAL (MAX of ACC_DT for either the Task or a Task that is Dual Credited)
I'm trying to take a Union Query that contains a giant list of all the Tasks (Task_ID) someone has accomplished with Accomplished Dates (ACC_DT) and combine that with a DualCredits query to generate a list with Distinct rows for each person based on the Task_ID.
For example someone could complete Task_ID 'P020' 20 times, but the only ACC_DT I'm concerned with is the Max Value for Task_ID 'P020' or if P020 can receive credit from another task such as P028 or P029, I want the ACC_DT from P028 or P029 to be used as the ACC_DT for P020.
I've attached a sample database of what I'm trying to work on. I edited all the sensitive info with bogus numbers.
I feel like I figured it out (although I'm not sure the way I accomplished it is the best) up to the Step3 query. You can see in record #174 it yields a date of 4/17/2009 when in the Step2 query (records 208-215) the Max date is 4/13/2011 and the should be the correct date that it gives me.
If any of this made sense and someone could help, I would very much appreciate it. I'm beating my head against a wall on this one. I very well could be going about this the entirely wrong way.
Base Info:
AllEventsRaw Union Query
Code:
SELECT SSAN, Task_ID, QTY, ACC_DT, Method, ENT_DT, PgmCode
FROM Flying_Current
UNION ALL SELECT SSAN, Task_ID, QTY, ACC_DT, Method, ENT_DT, PgmCode
FROM Flying_Archive;
DualCredits Query
Code:
SELECT DISTINCT DualCredits.Task_ID, DualCredits.Force_ID
FROM DualCredits;
Desired Outcome (A Query with the following Column Headers)
SSAN
Task_ID
ACC_DT_FINAL (MAX of ACC_DT for either the Task or a Task that is Dual Credited)
I'm trying to take a Union Query that contains a giant list of all the Tasks (Task_ID) someone has accomplished with Accomplished Dates (ACC_DT) and combine that with a DualCredits query to generate a list with Distinct rows for each person based on the Task_ID.
For example someone could complete Task_ID 'P020' 20 times, but the only ACC_DT I'm concerned with is the Max Value for Task_ID 'P020' or if P020 can receive credit from another task such as P028 or P029, I want the ACC_DT from P028 or P029 to be used as the ACC_DT for P020.
I've attached a sample database of what I'm trying to work on. I edited all the sensitive info with bogus numbers.
I feel like I figured it out (although I'm not sure the way I accomplished it is the best) up to the Step3 query. You can see in record #174 it yields a date of 4/17/2009 when in the Step2 query (records 208-215) the Max date is 4/13/2011 and the should be the correct date that it gives me.
If any of this made sense and someone could help, I would very much appreciate it. I'm beating my head against a wall on this one. I very well could be going about this the entirely wrong way.