Ranking Items in Multiple Categories

  • Thread starter Thread starter MJ
  • Start date Start date
M

MJ

This is my first time trying this medium of access support
so I hope that I can explain it correctly. What I have is
a long list of items that need to be ranked. The kicker is
these items fall into multiple categories and I need them
ranking within the category.

EX:

Sales Category Name Total Ranking
Computers George 10,000 1
Computers Nancy 9,000 2
Software George 5,000 2
Software Nancy 7,000 1

Can anyone help me?

The different categories that I will have to rank will be
in ascending and descending order, depending on the
category.

Thanks!

MJ
 
I don't know what you mean be "ascending and descending order, depending on
the category". To get a rank by category, you can use a subquery:

SELECT tblA.*,
(SELECT Count(*)
FROM tblA A
WHERE A.SalesCategory = tblA.SalesCategory
AND A.Total >=tblA.Total) as Ranking
FROM tblA;
 
Back
Top