Adding Ranking to a Query

G

Guest

Ihave a client who needs to see the top 50 revenue generators (sp?). Is there a way that i can display the top 50 (which i know how to do0 and have their ranking (i.e. 1,2,3 etc) displayed in an adjacent column?
 
M

Michel Walsh

Hi,


SELECT a.PeopleID, LAST(a.Revenue), COUNT(*)
FROM myTable As a INNER JOIN myTable As b
ON a.Revenue <=b.Revenue
GROUP BY a.PeopleID
HAVING COUNT(*) <= 50
ORDER BY COUNT(*)


Hoping it may help,
Vanderghast, Access MVP


Joe From Jersey said:
Ihave a client who needs to see the top 50 revenue generators (sp?). Is
there a way that i can display the top 50 (which i know how to do0 and have
their ranking (i.e. 1,2,3 etc) displayed in an adjacent column?
 

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

Top