B
bigbore50
Problem with query and subquery
I want to find the top three dates of [qry_ audit-rep-all].COMPLETED
for each [qry_audits-needed-dlr-info].[5-Digit Dealership Number]
SELECT DISTINCT [qry_audits-needed-dlr-info].[5-Digit Dealership
Number], [qry_ audit-rep-all].[4-DIGIT], [qry_ audit-rep-all].[AUDIT
REP], [qry_ audit-rep-all].[Audit Rep 2], [qry_
audit-rep-all].COMPLETED
FROM [qry_ audit-rep-all] INNER JOIN [qry_audits-needed-dlr-info] ON
[qry_ audit-rep-all].PRIMARY_NUMBER =
[qry_audits-needed-dlr-info].[5-Digit Dealership Number]
ORDER BY [qry_ audit-rep-all].COMPLETED DESC;
This code shows all the previous completer dates
I know i need to form a subquery but i can't seem to get one to work...
This is what i want it to do
PDN Completed
12345 12/25/2006
12345 11/22/2006
12345 10/21/2006
23456 11/28/2006
23456 8/23/2006
23456 2/20/2006
I want it to do the above.... I can't seem to get it to sort the top 3
completed dates
of each PDN
p.s. there will be values in the middle but they don't matter for now
Does this make sense
I want to find the top three dates of [qry_ audit-rep-all].COMPLETED
for each [qry_audits-needed-dlr-info].[5-Digit Dealership Number]
SELECT DISTINCT [qry_audits-needed-dlr-info].[5-Digit Dealership
Number], [qry_ audit-rep-all].[4-DIGIT], [qry_ audit-rep-all].[AUDIT
REP], [qry_ audit-rep-all].[Audit Rep 2], [qry_
audit-rep-all].COMPLETED
FROM [qry_ audit-rep-all] INNER JOIN [qry_audits-needed-dlr-info] ON
[qry_ audit-rep-all].PRIMARY_NUMBER =
[qry_audits-needed-dlr-info].[5-Digit Dealership Number]
ORDER BY [qry_ audit-rep-all].COMPLETED DESC;
This code shows all the previous completer dates
I know i need to form a subquery but i can't seem to get one to work...
This is what i want it to do
PDN Completed
12345 12/25/2006
12345 11/22/2006
12345 10/21/2006
23456 11/28/2006
23456 8/23/2006
23456 2/20/2006
I want it to do the above.... I can't seem to get it to sort the top 3
completed dates
of each PDN
p.s. there will be values in the middle but they don't matter for now
Does this make sense