1

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.

  • 2
    You are probably not on mysql version 8 or above. – P.Salmon Jul 31 '18 at 07:20
  • 2
    This shouldn't be generating an error, assuming your version of MySQL supports this window function syntax. Please check AWS and make sure you're really using MySQL 8+. – Tim Biegeleisen Jul 31 '18 at 07:20
  • I checked, and I have locally installes MySQL 8+, but Amazon RDS only supports MySQL 5+ (when i connect remotely to the amazon rds database, the console shows version Server version: 5.6.39-log MySQL Community Server (GPL) Is there any way around this? – Adolfo Villalobos Vega Jul 31 '18 at 08:06

0 Answers0