MariaDB 10.3.14 RANK()OVER函数引发语法错误

时间:2019-04-27 18:59:53

标签: mysql mariadb

我最近将我的MariaDB 5.5升级到了MariaDB 10.3.14,以便能够使用10.2之后引入的RANK()OVER函数。

经过升级过程后,我仍然收到与5.5相同的语法错误消息。

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RANK() OVER (
        ORDER BY
            at line 2 

我试图了解为什么在升级后仍然出现相同的错误。 这是我正在使用的查询:

SELECT member_id, total_pts, correct_predictions, correct_goals
    RANK() OVER (
        ORDER BY
            total_pts DESC,
            correct_predictions DESC,
            correct_goals DESC
        ) rank
FROM quiniela_1;

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

SELECT member_id, total_pts, correct_predictions, correct_goals之后加上逗号,以便您的查询显示为:

SELECT member_id, total_pts, correct_predictions, correct_goals,
    RANK() OVER (
        ORDER BY
            total_pts DESC,
            correct_predictions DESC,
            correct_goals DESC
        ) rank
FROM quiniela_1;