Limit query without using TOP

D

DeDBlanK

Hello,
NooB posting, so forgive me if I don't get everything correct.
I am trying to run a query that calls the TOP 25 in access 2003.
The query calls two fields, SumOfTotal and strDescription.

SELECT TOP 25 Query2.SumOfTotal, Query2.strDescription
FROM Query2
GROUP BY Query2.SumOfTotal, Query2.strDescription
ORDER BY Query2.SumOfTotal DESC;

I believe the problem is I recieve 26 records due to the total values
of the last few of the SumOfTotal records are all the same values.
Where in that the SumOfTotal have different values there is no
problems. All I need to do is limit the records to 25? Any
suggestions?
 
A

Allen Browne

Add the other field to the ORDER BY clause as well.

That way, if there is a tie, Access can decide which one to return, instead
of returning both (the extra record.)
 
D

DeDBlanK

Thanks Allen. Just wanted to say that many of your posted solutions
have helped me more than you could possibly know. Thank you again for
being an advid benefactor to the world.
 

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

Crosstab query totals 3
Running Total 1
Query changes on its own 2
Select Top 5 10
Top 11% 4
Reserved error (-3011) 1
loop though records in a query? 5
Limit record count in query 1

Top