Unrecognized statement type. (near “WITH” at position 0)

梦想的初衷 提交于 2020-01-06 05:22:06

问题


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;

回答1:


The WITH common table expression clause is only supported starting with MariaDB version 10.2.1. From the documentation:

Common Table Expression WITH was introduced in MariaDB 10.2.1.

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;


来源:https://stackoverflow.com/questions/51759466/unrecognized-statement-type-near-with-at-position-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!