Extract last 3 records from each account on database

G

Guest

I would like to create a query that only extracts the last 3 records
attributed to each unique account on an Access 2000 database. Each entry is
dated but some accounts have more records than others so a date range doesn't
help. I feel that there is a simple solution available here but I am unable
to find it, I don't know visual basic which doesn't help and my knowledge of
expressions is limited at this stage. Any suggestions?
 
G

Guest

Try something like

Select T1.* From TableName As T1 Where
T1.DateFieldName In (Select Top 3 T2.DateFieldName From TableName As T2
Where T2.[AccountNumber] = T1.[AccountNumber] Order By T2.[DateFieldName]
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