Hey guys, this is the first time I have ever needed to make a sub-select query and my brain is having a hard time understanding what it is I am doing.
I am following a tutorial found HERE
As for my data I have three fields, fk_SupplierID, AuditStartDate and LeadAuditorAuditHistory
I need to get the Max(AuditStartDate) and the matching LeadAuditor for that date. I feel like I am really close but at this point I need some help.
This is my SQL:
When I try to run the query I get the enter parameter dialog box for LastAuditDate, and I am not sure why.
I am following a tutorial found HERE
As for my data I have three fields, fk_SupplierID, AuditStartDate and LeadAuditorAuditHistory
I need to get the Max(AuditStartDate) and the matching LeadAuditor for that date. I feel like I am really close but at this point I need some help.
This is my SQL:
Code:
SELECT Q.fk_SupplierID, Q.LeadAuditorAuditHistory
FROM tblAuditHistory AS Q INNER JOIN tblAuditHistory AS T ON Q.AuditHistoryID = T.AuditHistoryID
WHERE LastAuditDate = (SELECT Max(T.AuditStartDate) FROM tblAuditHistory AS T WHERE T.fk_SupplierID = Q.fk_SupplierID);
When I try to run the query I get the enter parameter dialog box for LastAuditDate, and I am not sure why.