计算sql server 2008中的Percentile值

时间:2018-03-22 07:14:29

标签: sql-server percentile

我想计算sql server 2008中的Percentile值。 此脚本适用于sqlserver 2012但2008。 在sqlserver 2008中是否有percentile_cont等效?

select DISTINCT col_1,col_2
,PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY col_3) OVER (PARTITION BY col_1,col_2) AS P25
,PERCENTILE_CONT(0.50) WITHIN GROUP (ORDER BY col_3) OVER (PARTITION BY col_1,col_2) AS P50
,PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY col_3) OVER (PARTITION BY col_1,col_2) AS P75
from table

0 个答案:

没有答案