Most efficient way to get 1000 most recent rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a query to pull the most recent n rows from a table. I figure the most
efficient way must be to use the autonumber key since that is indexed. So I
need to get the highest key then all records prior to that up to a certain
number (say 1000).
How do I do that query (in SQL not the builder)?
 
Access Autonumbers are not guaranteed to be sequential, and if, perchance,
they are set to (or become) random assignment, you are NOT likely to get the
"last" 1000 rows.

Is there a date/time field in the table definition? Use that to sort on,
and use the TOP property of the query to limit how many rows are returned.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Similar Threads


Back
Top