Ranking Items in Multiple Categories

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
 
D

Duane Hookom

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;
 

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