I have some sample data like:
|H.RISK|NOTE|NORMAL|
The |
are actually in the data, it's a String
.
I am using Access, and am trying to exclude records that contain RISK
in the String.
Sample query:
SELECT * FROM someTable WHERE (UCase(someTable.Field) NOT LIKE '*RISK*') AND (UCase(someTable.Field) NOT LIKE '*Blah*') AND someTable.SomeOtherField <> 4;
The problem is, the query is returning the above sample record, even though it does contain the string RISK
.
I've tried the same query but switched to OR
instead of AND
but get the same results.
How can I properly structure this query to exclude records which contain certain strings?
看到您似乎正在使用SQL语法运行,请尝试使用正确的通配符。
SELECT * FROM someTable WHERE (someTable.Field NOT LIKE '%RISK%') AND (someTable.Field NOT LIKE '%Blah%') AND someTable.SomeOtherField <> 4;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.