Rank Totals based on a query

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I am trying to do a Ranking of Sales totals. I am not sure why the below is
not working. Can you rank based on a query that runs a grouping?

Thanks
Matt

SELECT qryCustomerSalesSummary2006_C1.SumOfEXT_PRICE, (Select Count(*) from _
qryCustomerSalesSummary2006_C1 Where [SumOfExt_Price] < _
[qryCustomerSalesSummary2006_C1].[sumOfExt_Price];) AS SalesRank _
FROM qryCustomerSalesSummary2006_C1;
 
G

Guest

I think you should add something like SalesCleckID or you will not know what
the rank means.
SELECT T.SalesCleckID, T.SumOfEXT_PRICE, (Select Count(*) from
qryCustomerSalesSummary2006_C1 As T1 Where T.[SumOfExt_Price] <=
[T1].[sumOfExt_Price];) AS SalesRank
FROM qryCustomerSalesSummary2006_C1 AS T
ORDER BY T.SumOfEXT_PRICE DESC;

Or this according the way you want the rank - High to Low or Low to High.
SELECT T.SalesCleckID, T.SumOfEXT_PRICE, (Select Count(*) from
qryCustomerSalesSummary2006_C1 As T1 Where T.[SumOfExt_Price] >=
[T1].[sumOfExt_Price];) AS SalesRank
FROM qryCustomerSalesSummary2006_C1 AS T
ORDER BY T.SumOfEXT_PRICE;
 

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