Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top 5 Customers

Status
Not open for further replies.

horna

Programmer
Jan 29, 2002
210
US
I am writing a report that has customers, and the products that are sold to each customer. Is there a way to limit each customer's details to the top 5 products sold to them. I first have to figure out the top 5, then limit the print to just 5 product details.

Thank you very much for your help.
 
Something like...

Code:
SELECT Top 5 Product, Qty, Cost
FROM tblSales
WHERE CustomerID = 14


Randy
 
You said NOTHING about your actual schema, so just a guideline:
the TOP 5 predicate should be in a correlated subquery.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you very much. I will give it a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top