gpt4 book ai didi

sql - 通过 union all 使用多个 with 语句

转载 作者:行者123 更新时间:2023-12-01 08:29:01 24 4
gpt4 key购买 nike

WITH L1 AS
(
SELECT
)
SELECT A FROM L1

UNION ALL

SELECT A FROM TABLE

UNION ALL

WITH L2 AS
(
SELECT
)
SELECT A FROM L2

UNION ALL

WITH L3 AS
(
SELECT
)
SELECT A FROM L3

我收到一个错误

Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon."



请帮忙

最佳答案

语法是

With l1 ( a ) as ( Select ... )
, l2 ( a ) as ( ... )
Select ... From ...
Union
Select ... From ...

关于sql - 通过 union all 使用多个 with 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25317210/

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