"Unrecognized statement type. (near "WITH" 在位置 0)" mysql

"Unrecognized statement type. (near "WITH" at position 0)" mysql

我的查询结构如下。

WITH cte1 AS (SELECT a, b FROM table1) SELECT * FROM cte1;

但出现以下错误

Unrecognized statement type. (near "WITH" at position 0)

我用 mysql --version 命令检查了我的 MySQL 版本,我的 MySQL 版本是 mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper

"with" 关键字有问题。

你能帮我解决这个问题吗?

如果您需要常用 table 表达式,请使用 MySQL 版本 8+ 或 MariaDB 10.2+。