使用百分位数查询创建表

时间:2019-06-26 18:27:29

标签: sql-server

我试图通过百分位数查询创建一个新表,以便可以将其导出到ARCGIS。但是,我收到语法错误,我不知道该如何解决。

create table tempercent as (select *,  percentile_CONT(.95)  
WITHIN GROUP (ORDER BY cast(travel_time_minutes as float)) OVER (PARTITION BY TMC_code) AS TTAV_P_80 FROM [dbo].[Andy_I40])

1 个答案:

答案 0 :(得分:1)

SQL Server不支持CTA。您可以改用SELECT ... INTO

SELECT *,  PERCENTILE_CONT(.95)  
      WITHIN GROUP (ORDER BY cast(travel_time_minutes as float)) 
      OVER (PARTITION BY TMC_code) AS TTAV_P_80 
INTO tempercent
FROM [dbo].[Andy_I40]