Currently, I'm working on a database on Amazons rds platform, and i'm connecting through mysql server.
At some point, I need to perform a rolling average of the form:
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;
The error I get is the following:
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
I've tried with different tutorials to perform this operation, and the result is always the same. I always get a syntax error.
Can you help me figure out what if the problem here?. Thanks in advance.