Showing Top amounts in a query

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

Guest

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

Similar Threads

how to write a query to display sum 1
Remaining Balance Query 2
Error 3070 and a CrossTab Query 4
query too slow 1
UNION query Challenges 2
Duplicates in union query 3
Crosstab Query 1
Simple query?? 4

Top