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
 
Back
Top