Reputation: 31
MS Access SQL, SELECT last five highest values in a column
For example I have table named games, I want top five games with highest likes.
Upvotes: 1
Views: 1084
Reputation: 32713
Something like this:
select top 5 *
from games
order by likes desc, id desc
I have added a "tie-breaker" to the order by clause to prevent access returning more than 5 records, i.e. the primary key.
Thanks to @Fionnuala for pointing out this issue with Access. For more info, see here
Upvotes: 6