Top 5 Query Question

D

dTHMTLGOD

I have a table with a 2,000 + records.

I need to pull the top 5 problems from each office. The fields in the
tables are Office, Problem, User.
My queries right now only pulls the top 5 from the table (see below). I
would like to pull the top 5 from each office.

This one pulls the top 5 from the table

SELECT TOP 5 TypeItem.TypeItem, Count(TypeItem.TypeItem) AS CountOfTypeItem,
Locations.Location
FROM TypeItem RIGHT JOIN Locations ON TypeItem.Office=Locations.Code
GROUP BY TypeItem.TypeItem, Locations.Location
ORDER BY Count(TypeItem.TypeItem) DESC;
 

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


Top