Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix WITH statement not valid at this position for this server version LATEST VERSION INSTALLED

Tags:

mysql

image hereMySQL Workbench tells me that can't find WITH valid for this server version although I already have the latest SERVER version installed - 5.7.27. Workbench is 8.0.17

WITH all_customers_and_reps AS 
(
    SELECT customer.customerNumber, customer.salesRepEmployeeNumber
    FROM customer
    WHERE salesRepEmployeeNumber = 1166
)
SELECT * FROM all_customers_and reps;
like image 450
Ollie Avatar asked Sep 15 '25 09:09

Ollie


1 Answers

The Common table expressions available starting from mysql versions 8.0 You could sobstitute with a dinamic/temporary table eg:

SELECT * FROM (
    SELECT customer.customerNumber, customer.salesRepEmployeeNumber
    FROM customer
    WHERE salesRepEmployeeNumber = 1166

) all_customers_and reps;
like image 56
ScaisEdge Avatar answered Sep 18 '25 05:09

ScaisEdge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!