Rank/Number fields

K

Keith

I am trying to rank customers by their total sales. I have a query
'qryInvoiceSalesSummaryMargin' that has the totals for each customer with a
margin percent. I started a new query called
'qryInvoiceSalesSummaryMarginCount' that I would like to rank my customers in
each Profit Center by the 'Price' field. Here is what it looks like now.

SELECT qryInvoiceSalesSummaryMargin.[Profit Center Number],
qryInvoiceSalesSummaryMargin.Terminal, qryInvoiceSalesSummaryMargin.CustNum,
qryInvoiceSalesSummaryMargin.Name, qryInvoiceSalesSummaryMargin.Price,
qryInvoiceSalesSummaryMargin.AvgPrice, qryInvoiceSalesSummaryMargin.[Margin%]
FROM qryInvoiceSalesSummaryMargin
ORDER BY qryInvoiceSalesSummaryMargin.[Profit Center Number],
qryInvoiceSalesSummaryMargin.Price DESC;
 
K

KARL DEWEY

Try this --

SELECT CustNum,Name, Price, (SELECT COUNT(*)
FROM [qryInvoiceSalesSummaryMargin] T1
WHERE T1.Price >= T.Price) AS Rank
FROM [qryInvoiceSalesSummaryMargin] AS T
ORDER BY Price DESC;
 

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

Similar Threads

rank in select query not right 1
Rank and row number in Access? 3
monthly totals 0
query to get top player 8
Adding up row values 4
Sales Ranks 1
Top 10 SQL Query 2
Contest rank by class 1

Top