Top 5 Query Question

  • Thread starter Thread starter dTHMTLGOD
  • Start date Start date
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;
 
Back
Top