Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Select top 5...

Author  Topic 

pussher
Starting Member

1 Post

Posted - 2002-07-10 : 08:16:49
I've an access database, with the most important fields being "refId" and "dateAdded". The database contains several records such as:

refId, dateAdded
****************
1, 11/07/02
2, 11/07/02
3, 11/07/02
4, 11/07/02
5, 11/07/02
6, 11/07/02
7, 11/07/02
1, 10/07/02
...

I would like to run a query that only selects the 5 most recent records (referring to the dateAdded).

I've tried the following, but this returns 7 records with date 11/07/02.

"select top 5 dateAdded from tblTest order by dateAdded desc"

Does anyone can help me out with this? Thx!

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2002-07-10 : 12:15:42
select top 5 dateAdded from tblTest order by dateAdded desc,refid

Go to Top of Page
   

- Advertisement -