-1

我有以下 where 语句,并且我不断收到与 a ) 相关的错误,并且当我运行它时,会弹出不正确的语法错误。我不知道我在哪里犯了错误,我已经重写了好几次。

WHERE     (dbo.COL_V_Cost.RRDD NOT LIKE '12%') AND (dbo.COL_V_COST.RRDD NOT LIKE '13%') AND (dbo.COL_V_Cost.RRDD NOT LIKE '2706%') AND (dbo.COL_V_Cost.RRDD NOT LIKE '2707%') AND (dbo.COL_V_Cost.RRDD NOT LIKE '2331%') AND (dbo.COL_TBL_VCOURSE.DEP_TYP_CD = 'H&S') AND (COL_V_COST.TNG_SYS_NR NOT ('0113','0197','0290','0489','0542','0974','1318','1322','1397','1401','1444','1446','1580'))
4

2 回答 2

1

您缺少IN最后一个过滤器:

WHERE (dbo.COL_V_Cost.RRDD NOT LIKE '12%') 
  AND (dbo.COL_V_COST.RRDD NOT LIKE '13%') 
  AND (dbo.COL_V_Cost.RRDD NOT LIKE '2706%') 
  AND (dbo.COL_V_Cost.RRDD NOT LIKE '2707%') 
  AND (dbo.COL_V_Cost.RRDD NOT LIKE '2331%') 
  AND (dbo.COL_TBL_VCOURSE.DEP_TYP_CD = 'H&S') 
  AND (COL_V_COST.TNG_SYS_NR NOT IN ('0113','0197','0290','0489','0542','0974','1318','1322','1397','1401','1444','1446','1580'))
                                  ^-- this is missing

正确的语法是NOT IN

于 2013-01-24T13:31:11.883 回答
0

你的最终 AND 应该是“NOT IN”

于 2013-01-24T13:31:26.337 回答