A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Top 5 with grouping



 
 
Thread Tools Display Modes
  #1  
Old February 16th, 2007, 04:43 PM posted to microsoft.public.access.queries
AirgasRob
external usenet poster
 
Posts: 9
Default Top 5 with grouping

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;
  #2  
Old February 16th, 2007, 05:16 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Top 5 with grouping

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

"AirgasRob" wrote in message
news
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;



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:58 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.