Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top 20 pulling 23

Status
Not open for further replies.

Zonie32

Technical User
Jan 13, 2004
242
US
Hi all.

I have a query where I say pull Top 20. The 2 fields I am using are AgentName and #lives. It sorts by highest to lowest #lives.

Now, it works fine unless the 20th agent has 5 lives and so does the 21st, 22nd and 23rd agent.

It doesn't cut off at 20 because the #lives are the same as the 20th agent. How can I fix it so it cuts off at the 20th agent even though the next few agents have the same number of lives?
 
Posting the sql code would surely help us to help you.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Here is the SQL. I am using WIN XP Access 2003. thanks.

SELECT TOP 10 [Top 10 GAs].AgentName, Sum([Top 10 GAs].Lives) AS SumOfLives
FROM [Top 10 GAs]
GROUP BY [Top 10 GAs].AgentName
ORDER BY Sum([Top 10 GAs].Lives) DESC;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top