I need this query to pull just the last scan date, i.e. if a scan ran on 3/7/2012 I need just the records (there may be few or many) that pertain to that date and no other dates. When I run this query I am still getting all of the results (i.e. scan dates of 3/7/2012, 3/5/2012, 3/1/2012, etc)
Can you see something wrong that would be causing this? I just need the most recent date, even if there are many records for that date (i.e. 10 IP addresses that were all scanned on 3/5/2012)
FROM qryReportsCondensedPatchesAggregate CPA
INNER JOIN qryReportsScanSummaryWithDetailsAggregate SDA
WHERE CPA.ScanName LIKE '%mgmt%'
GROUP BY CPA.ScanName, CPA.pspplMSSeverity, CPA.smachIPAddress, SDA.PatchMissing, CPA.ScanDate
ORDER BY CPA.ScanDate DESC