Top 5 with grouping

A

AirgasRob

I am trying to get the top 5 results for each region. Any help would be
appreciatted, below is my sql thus far.

SELECT TOP 5 QryNullConv.AbsError, QryNullConv.DmdUnit, QryNullConv.Loc,
QryNullConv.Region
FROM QryNullConv;
 
J

John Spencer

TOP 5 for the region based on what.- the number of AbsError?

SELECT q.Region, q.AbsError, Q.DmdUnit, Q.Loc
FROM qryNullConv as Q
WHERE Q.AbsError in (
SELECT TOP 5 absError
FROM qryNullConv as T
WHERE T.Region = Q.Region
ORDER BY absError DESC)


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Top