Syntax error: WITH is not valid input in this position

WITH customers_in_usa AS is for now invalid MySQL code.
MySQL will support CTE’s in the future in MySQL version 8..

You could rewrite your SQL code, that should give the same results.

SELECT 
    customerName
  , state
FROM 
   customers 
WHERE
   country = 'USA'
 AND
   state="CA"
ORDER BY
   customerName

Leave a Comment