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

Anthony Baratta anthony at baratta.com
Tue Jun 14 15:17:09 CDT 2011


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

This way you don't lop off any at the "high" end that are equal to the highest result allowed at 95%. e.g. if you had more than one at 95 out of 100, the WITH TIES will take them all. Without it, you could lose all but one. Depending on the population count that equals 95%.

Hope that makes sense.

Rudy will set me straight, if I'm way off base. :-)

--
Anthony Baratta




More information about the thelist mailing list