title: Calculating percentile rankings in MS SQL
body: <p>What's the best way to calculate percentile rankings (e.g. the 90th percentile or the median score) in MSSQL 2005?</p>
  
  <p>I'd like to be able to select the 25th, median, and 75th percentiles for a single column of scores (preferably in a single record so I can combine with average, max, and min).  So for example, table output of the results might be:</p>
  
  <pre><code>Group  MinScore  MaxScore  AvgScore  pct25  median  pct75
  -----  --------  --------  --------  -----  ------  -----
  T1     52        96        74        68     76      84
  T2     48        98        74        68     75      85
  </code></pre>