无法识别的语句类型.(在位置 0 的“WITH"附近) [英] Unrecognized statement type. (near "WITH" at position 0)
本文介绍了无法识别的语句类型.(在位置 0 的“WITH"附近)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 mysql phpmyadmin,版本 10.1.34-maraiDB.我无法执行以下 cte 代码.代码我运行代码时显示的错误
I'm using mysql phpmyadmin, version 10.1.34-maraiDB. i cant execute the folling cte code. the code error shown when i run the code
WITH cte (Employee_ID, First_Name, Last_Name,Email, Phone, Hire_Date,
Manager_ID, Job_Title) AS
(
SELECT Employee_ID, First_Name, Last_Name,Email, Phone, Hire_Date,
Manager_ID, Job_Title
FROM employees
)
SELECT * FROM cteEmp;
推荐答案
WITH
公用表表达式子句仅支持从 MariaDB 版本 10.2.1
开始.来自 文档:
The WITH
common table expression clause is only supported starting with MariaDB version 10.2.1
. From the documentation:
公共表表达式 WITH 是在 MariaDB 10.2.1 中引入的.
Common Table Expression WITH was introduced in MariaDB 10.2.1.
但是,您可以简单地将 CTE 直接内联到查询中,它应该可以工作.在您的特定情况下,您可以只执行 CTE 中的代码:
But, you may simply inline your CTE directly into the query, and it should work. In your particular case, you may just execute the code inside the CTE:
SELECT Employee_ID, First_Name, Last_Name,Email, Phone, Hire_Date,
Manager_ID, Job_Title
FROM employees;
这篇关于无法识别的语句类型.(在位置 0 的“WITH"附近)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文