Top 3 Values in Query

K

K Reinhold

I have query called qry_top_three_percents. I need to return the top 3 percents for each group type. Please help!! The structure looks like the following

Group_Type Code_Q8 Code_Percen
Dept 1 1 54
Dept 1 6 20
Dept 1 11 10
Dept 1 24 5
Dept 1 42 2
Dept 2 1 36
Dept 2 24 14
Dept 2 6 10
Dept 2 37 6%
 
A

Arvin Meyer

Have a look at this KB article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;132056&Product=acc

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

K Reinhold said:
I have query called qry_top_three_percents. I need to return the top 3
percents for each group type. Please help!! The structure looks like the
following:
Group_Type Code_Q8 Code_Percent
Dept 1 1 54%
Dept 1 6 20%
Dept 1 11 10%
Dept 1 24 5%
Dept 1 42 2%
Dept 2 1 36%
Dept 2 24 14%
Dept 2 6 10%
Dept 2 37
6%
 
D

Drew Wutka

Yes, you can use a subquery, to be able to use the IN statement, however,
you need a unique key to do that, so if you have a unique key for each
record, you can use a subquery to pull the top three 'keys' per group, and
put that in an IN clause.

Drew

K Reinhold said:
I have played with it and am not having any luck. Is there anyway to use
the 'In (select top 3' function? I'm just not sure of the exact code to
use.
 
Top