在Oracle它工作得很好......替代在SQL Server 2008 PERCENTILE_CONT
查詢for Oracle是如下
Select distinct channel_id, position_id,datamonth,
percentile_cont(.9) within group (order by TRIM_PRE_ELIG_PAY)
over (partition by channel_id, position_id, datamonth) as TRIM_PRE_ELIG_PAY_90th_PERC
from Tablename
但對於SQL Server中,我發現了一個錯誤。下面是SQL Server 2008中查詢:
Select
distinct channel_id,
position_id, datamonth,
percentile_cont(.9) within group (order by TRIM_PRE_ELIG_PAY)
over (partition by channel_id) as TRIM_PRE_ELIG_PAY_90th_PERC
from table
ERROR: Select could not be parsed correctly. Output could not be generated.
我知道了,它可以在SQL Server 2012中正常工作,但需要另一種方式在SQL Server 2008
任何人可以幫助... ........