我的子查询给出错误:消息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