SQL以常规语法读取列

我不断收到这个错误

消息156,第15层,状态1,第97行   关键字“ Group”附近的语法不正确

I think SQL is reading it as a syntax like GROUP BY because it showing it in blue color, how can I fix this?

查询:

SELECT  
    SUM(s.TotalDue)
FROM
    [Sales].[SalesOrderHeader] s
INNER JOIN  
    SALES.SalesTerritory t ON s.TerritoryID = t.TerritoryID
WHERE       
    t.Group '%North America%'
评论
killo
killo

尝试将列名称放在方括号中

SELECT  SUM(s.TotalDue)
FROM    [Sales].[SalesOrderHeader] s
INNER JOIN  SALES.SalesTerritory t
ON          s.TerritoryID = t.TerritoryID
WHERE       t.[Group] like  '%North America%'
点赞
评论