Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TOP 5 Percent Grouped

Status
Not open for further replies.

thefox149

Technical User
Nov 22, 2004
158
AU
I have record in a table

Month Group Value

what i would like to do is find the top 5 percent value per month per group ..

the Top 5 Percent only bings back the TOP 5 Percent record count in the table eg top 5 record in a table of 100
 
You might try something along these lines:
Code:
SELECT T1.*
FROM MyTable T1
WHERE T1.Value In
(SELECT TOP 5 PERCENT T2.Value
 FROM MyTable T2
 WHERE T2.Month=T1.Month AND T2.Group=T1.Group
 ORDER BY T2.Value;)
;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top