1

我在 Spotfire 中使用数据函数。我已经安装了 sqldf 包。这是查询:

#Package to run sqls
library(sqldf)
#Input data frame
op1 <- sqldf("SELECT Prod_parnt,prodct_grop,year,month,week,
count(distinct id) as prd_cnt,
Sum(Count(distinct id))
over (partition by modlty,prodct_grop order by year,month,week
rows between 12 preceding and current row) as cumu_prd_cnt,
avg(rate) as sal_rate
FROM ip1
group by Prod_parnt,prodct_grop,year,month,week")

我面临的错误:

“TIBCO Spotfire 统计服务返回错误:'错误:语句中的错误:靠近“(”:语法错误'。”

现在这里要注意的是,当我删除Window函数语句即cumu_prd_cnt字段时;代码工作正常。

需要你的帮助。

4

0 回答 0