Showing Top amounts in a query

J

juliejg1

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.
 
K

Ken Sheridan

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
 
Top