Return Top 3 Values for Each Group

K

K McGee

I have a query with 2 fields [Group_Type] and [Percent_Codes]. I need to return the top three percent values for each group type. Can anyone assist?
 
J

Jonathan Blitz

Select Group_type,Percent_Codes
From mytable tab1
Where 3 > (Select count(*) from mytable tab2
where tab1.group_type = tab2.group_type
and tab2.percent_codes > tab1.percent_codes)


--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
K McGee said:
I have a query with 2 fields [Group_Type] and [Percent_Codes]. I need to
return the top three percent values for each group type. Can anyone assist?
 
Top