Filtering For Top 5 Items

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 90 customers and over 500 products. I want to write a query that will
show the top 5 products in unit sales for each customer and filter out the
6th highest and all the rest for each customer. I would like to keep all
customers and their top 5 selling products in one query- like this:

Cust1 ProdA
Cust1 ProdB
Cust1 ProdC
Cuts1 ProdD
Cust1 ProdE
Cust2 ProdD
Cust2 ProdA
Cust2 ProdZ
Cust2 ProdC
Cust2 ProdP
....etc.

I can't get past the query that lists all of the products and their total
units:

Cust1 ProdA 100
Cust1 ProdB 85
....etc.

Some customers have ordered 200 or more different products with totals
ranging from 1 - 100 for each different product, how can I pull out only the
top 5 and still show all of the customers in one report?

Thanks in advance,
c
 
Back
Top