"Elden Carnahan" <el***********@comcast.net> wrote in message
news:jJ********************@comcast.com...
I am trying to derive rank values in a query, just as one would with the
Rank function in Excel. Can't see how to do this elementary task. Can
anyone advise?
This ranks the products in the Northwind products table by price:
select p1.ProductName, UnitPrice,
(
select count(*) from Products p2
where p2.UnitPrice >= p1.UnitPrice
) AS Rank
from Products as p1
order by UnitPrice desc