stddev_samp()函数可以与windows函数一起使用吗?

时间:2017-10-05 22:56:20

标签: amazon-redshift

我想为客户计算最近10次购买的移动平均线和移动标准差。

 avg(price) over (partition by customer_id order by purchase_date rows between 10 preceding and current row) as avg_price_10_orders,

我知道我可以计算平均值,但是我读到了关于我是否可以用这种方式计算标准偏差的相互矛盾的信息:

stddev_samp(price) over (partition by customer_id order by purchase_date rows between 10 preceding and current row) as sd_10_orders

我在Amazon Redshift群集上,AWS文档表明它没关系:http://docs.aws.amazon.com/redshift/latest/dg/r_WF_STDDEV.html

然而,Cloudera的消息来源说stddev_samp()不允许与over()子句一起使用:https://www.cloudera.com/documentation/enterprise/5-3-x/topics/impala_stddev.html

任何指针?

谢谢!

0 个答案:

没有答案