繁体   English   中英

Not Like Operator 无法使用 ACCESS/SQL 查询

[英]Not Like Operator not working using ACCESS/SQL query

我目前正在尝试排除带有“Not Issue”字样的评论,但由于某种原因它部分有效。 当我删除下面的代码时,我得到了 100 个值,但是当我在下面添加语法时它返回 50,但是在这 50 个字段中,仍然有一些行包含“Not Issue”。

INSERT INTO Combined_Comments ( [ID], [Comment] ) 
SELECT [Comments_001].[ID], IIf([Comments]<>" ","BR
#" & [Branch Number] & " - " & [Comments],[Comments]) AS [Dup Comment] 
FROM [Comments_001] 
WHERE ((Not (IIf([Comments]<>" ","BR #" & [Branch Number] & " - " & [Comments],[Comments]))<>"%not issue%") AND (([Dup Vin Comments_085].[Dup Ind])<>" "));

在 MS Access 中,类似的通配符是“*”,而在 SQL 服务器中是“%”,因此查询中的 sql 应该是:

INSERT INTO Combined_Comments ( [ID], [Comment] ) 
SELECT [Comments_001].[ID], IIf([Comments]<>" ","BR
#" & [Branch Number] & " - " & [Comments],[Comments]) AS [Dup Comment] 
FROM [Comments_001] 
WHERE ((Not (IIf([Comments]<>" ","BR #" & [Branch Number] & " - " & [Comments],[Comments])) not like "*not issue*") AND (([Dup Vin Comments_085].[Dup Ind])<>" "));

我看到很多“非”运算符,并假设双重否定可以满足您的需求。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM