问题
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