SQL子查询错误附近)

前端之家收集整理的这篇文章主要介绍了SQL子查询错误附近)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的子查询给出错误:消息102,级别15,状态1,行17”’附近的语法不正确.
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,br.Branch) as x

猜你在找的MsSQL相关文章