[thelist] SQL Server 2008 - How to get the 95% percentile?

Anthony Baratta anthony at baratta.com
Tue Jun 14 15:10:32 CDT 2011


> -----Original Message----- 
> From: "Luther, Ron" <Ron.Luther at hp.com> 
> To: thelist at lists.evolt.org 
> Date: 06/14/11 12:01 
> Subject: [thelist] SQL Server 2008 - How to get the 95% percentile? 
> 
> Hi Gang,
> 
> Got a friend asking how you use sql to find the 95th percentile in sql server 2008.
> 

Ron...

Here's my best guess:

SELECT AVG(score) FROM 
(SELECT TOP 95 PERCENT score FROM dbo.TestScores
ORDER BY score ASC) AS Top95PercentAvg

I assumed that you want to lop off the highest not the lowest.

--
Anthony Baratta




More information about the thelist mailing list