Rank/Number fields

G

Guest

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;
 
G

Guest

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

Top 10 SQL Query 2
rank in select query not right 1
Sales Ranks 1
Rank and row number in Access? 3
Adding up row values 4
Query help please. 3
Contest rank by class 1
Sum in Query 1

Top