gpt4 book ai didi

SQL子查询错误,附近)

转载 作者:行者123 更新时间:2023-12-04 03:08:46 30 4
gpt4 key购买 nike

我的子查询给出了一个错误:Msg 102, Level 15, State 1, Line 17 Incorrect syntax near ')'.

SELECT SalesArea, Branch, Volume
from
(select
br.SalesArea as SalesArea
,br.Branch as Branch
, sum(a.Volume) as Volume
FROM dbo.vDetail a with (nolock)
LEFT JOIN
dbo.vBranch AS br WITH (nolock)
ON a.Branch = br.Branch
group by a.Volume, br.SalesArea, br.Branch)

最佳答案

您缺少子查询的别名,请尝试一下。

SELECT SalesArea, Branch, Volume
from
(select
br.SalesArea as SalesArea
,br.Branch as Branch
, sum(a.Volume) as Volume
FROM dbo.vDetail a with (nolock)
LEFT JOIN
dbo.vBranch AS br WITH (nolock)
ON a.Branch = br.Branch
group by a.Volume, br.SalesArea, br.Branch) as x

关于SQL子查询错误,附近),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11576054/

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