What\'s the best way to calculate percentile rankings (e.g. the 90th percentile or the median score) in MSSQL 2005?
I\'d like to be able to select the 25th, median,
i'd do something like:
select @n = count(*) from tbl1 select @median = @n / 2 select @p75 = @n * 3 / 4 select @p90 = @n * 9 / 10 select top 1 score from (select top @median score from tbl1 order by score asc) order by score desc
is this right?