I have been searching for an answer and have had no luck. I am using Access 2016 and I am trying to build an aggregate query that will pull results based on two scenarios. I can get one to work, but not the other and I don't know where else to look or try. I have a table that stores audit results on job processes. The fields are as follows:
AuditID (PK)
AuditDate
JobProcess
Auditor
Score - results here could be "Good" or "No Good".
Here is a sample of some data:
1 April 13 Job 1 John Smith Good
2 April 25 Job 1 John Smith No Good
3 April 26 Job 1 Jane Doe Good
4 April 26 Job 2 Jane Doe Good
I want the query results to be as follows:
April 25 Job 1 John Smith No Good
April 26 Job 1 Jane Doe Good
April 26 Job 2 Jane Doe Good
Now, I have been able to create an aggregate query that produces the Max by Date, but then only returns one of Jane Doe's records and not both. If I try to create a query to show both of Jane Doe's records, I also get BOTH of John Smith's, and I only want the latest. This is the SQL I have been working on:
Can anyone offer any guidance? Thank you.
AuditID (PK)
AuditDate
JobProcess
Auditor
Score - results here could be "Good" or "No Good".
Here is a sample of some data:
1 April 13 Job 1 John Smith Good
2 April 25 Job 1 John Smith No Good
3 April 26 Job 1 Jane Doe Good
4 April 26 Job 2 Jane Doe Good
I want the query results to be as follows:
April 25 Job 1 John Smith No Good
April 26 Job 1 Jane Doe Good
April 26 Job 2 Jane Doe Good
Now, I have been able to create an aggregate query that produces the Max by Date, but then only returns one of Jane Doe's records and not both. If I try to create a query to show both of Jane Doe's records, I also get BOTH of John Smith's, and I only want the latest. This is the SQL I have been working on:
Code:
SELECT Max(Audit.AuditDate) AS AuditDate, Max(Audit.JobProcess) AS JobProcess, Audit.Auditor, Audit.Score
FROM Audit
GROUP BY Audit.Auditor, Audit.Score
HAVING ((Max(Audit.AuditDate)) Between [Forms]![frmAudit]![FromDate] And [Forms]![frmAudit]![ToDate]);
Can anyone offer any guidance? Thank you.