last three records only based on dates

J

jademaddy

I have a table that contains the following fields.

Store Date Loss

This table currently holds about 4 years worth of audit results for each of
my stores. Each store possibly having at least 20 records and there are
approx 800 stores.

Could someone point me in the general direction of producing a query that
will show just the lastest three records per store based on the date field.

Access 2003

Thanks
 
J

John Spencer

You'll need a subquery for this to get the TOP 3 records per store

SELECT *
FROM AuditResults
WHERE {Date] in
(SELECT TOP 3 T.[Date]
FROM AuditResults as T
WHERE T.Store = AuditResults.Store
ORDER BY T.[Date] DESC)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top