"Bottom" SQL

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

Guest

As far as I know, a "BOTTOM" SQL command does not exist

I would like to run a Query & select the "Bottom 39" Records to end wit
the Current Date's Record

I know I can run a "long" Date Span where I would retrieve at least 39 Record
(or the total number of Records matching the criteria). I can then Sort DES
& fill/ make a Table with the "most recent" 39 Records

Input welcomed on a better way to do that. TIA - Bob
 
As far as I know, a "BOTTOM" SQL command does not exist.

I would like to run a Query & select the "Bottom 39" Records to end with
the Current Date's Record.

I know I can run a "long" Date Span where I would retrieve at least 39 Records
(or the total number of Records matching the criteria). I can then Sort DESC
& fill/ make a Table with the "most recent" 39 Records.

Input welcomed on a better way to do that. TIA - Bob

The 'Bottom" as determined by what field?
If I understand you correctly, the method to show the X highest (or X
lowest) records is to create a Top X query that is sorted Descending
(or Ascending) on the field in question.

SELECT TOP 39 YourTable.LastName, YourTable.[First Name],
YourTable.ANumber FROM YourTable WHERE YourTable.ADate) <=Date()
ORDER BY YourTable.ANumber;

Change the sort order ...
ORDER BY YourTable.ANumber
to Descending:
ORDER BY YourTable.ANumber DESC:

if that more accurately fits your needs.

You may get more than 39 records if there are any ties at the last
position.
 
Dear Bob:

If you sort DESC (descending) and choose the top 39, you'll
effectively get the bottom 39.

If you need this in ascencing order, make another query based on that
one and resort.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Yes, right after I posted the Question, I realized what to do...exactly what you recommended

I see Tom recommended the same

I feel silly.

Thank you both, Bob
 
Yes, right after I posted the Question, I realized what to do...exactly what you recommended

I see Tom recommended the same

I feel silly.

Thank you both, Bob
 

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