gpt4 book ai didi

mysql - 语法错误 : WITH is not valid input in this position

转载 作者:行者123 更新时间:2023-11-29 04:05:21 26 4
gpt4 key购买 nike

所以我有这个类似的请求

    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;

但是当我写它的时候我发现了一个错误:'WITH is not valid input in this position' error_picture .你能帮我理解这段代码有什么问题吗?

最佳答案

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

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

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

关于mysql - 语法错误 : WITH is not valid input in this position,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46410422/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com