当前,我正在Amazon rds平台上的数据库上工作,并且正在通过mysql服务器进行连接。
在某个时候,我需要执行以下形式的滚动平均值:
SELECT
id, x_axis,time,
AVG(x_axis) OVER (ORDER BY time
ROWS BETWEEN 8 PRECEDING AND 0 FOLLOWING)
AS running_average
FROM falla_machinedata
ORDER BY id;
我得到的错误如下:
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '(ORDER BY time ROWS BETWEEN 8 PRECEDING AND 0
FOLLOWING)AS running_aver' at line 3
我尝试使用不同的教程来执行此操作,结果始终是相同的。我总是收到语法错误。
您能帮我找出问题所在吗?预先感谢。