Ranking

  • Thread starter Thread starter vp
  • Start date Start date
V

vp

Colums
A 7 char, repeating values
B 7 char, repeating values
C Number, random numbers

Sorted after A ascending, sorted after C descending.

For each single value of A I want to rank the values of C, 1 with the
highest C, 2 for the second highest C and so forth.
 
Substitute your table and field names --
SELECT Q.[Group], Q.[Item_no], Q.[Points], (SELECT COUNT(*) FROM [Product] Q1
WHERE Q1.[Group] = Q.[Group]
AND Q1.[Points] < Q.[Points])+1 AS Rank
FROM Product AS Q
ORDER BY Q.[Group], Q.[Points] DESC;
 
Back
Top