Showing Top amounts in a query

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

Guest

I have a query with 3 fields: Industry, Vendor, Total amount with vendor.
I would like to show by industry, the top 100 suppliers based on the total
amount with the supplier.
 
Try this:

SELECT Q1.*
FROM YourQuery AS Q1
WHERE Vendor IN
(SELECT TOP 100 Vendor
FROM YourQuery AS Q2
WHERE Q2.Industry = Q1.Industry
ORDER BY [Total amount with vendor] DESC);

Ken Sheridan
Stafford, England
 

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

Back
Top