语法错误:WITH在此位置输入无效 [英] Syntax error: WITH is not valid input in this position

查看:69
本文介绍了语法错误:WITH在此位置输入无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有类似的要求

    WITH customers_in_usa AS (
        SELECT 
           customerName, state
        FROM
           customers
        WHERE
           country = 'USA'
    ) SELECT 
        customerName
    FROM
        customers_in_usa
    WHERE
        state = 'CA'
    ORDER BY customerName;

但是在编写时,我遇到了一个错误:在该位置输入无效"'错误图片.您能帮我理解这段代码有什么问题吗?

But when wrote it I caught an error: 'WITH is not valid input in this position' error_picture. Can you help me to understand what's wrong in this code?

推荐答案

WITH customers_in_usa AS目前是无效的MySQL代码. MySQL将来将在MySQL版本8中支持CTE.

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

您可以重写您的SQL代码,这应该产生相同的结果.

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

这篇关于语法错误:WITH在此位置输入无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆