我在使用NOT LIKE
时遇到问题。据我所知,这是正确的语法,但是,查询仍返回[H1 Full Name] = SPEC
的记录。任何想法为什么会这样?
SELECT [Unit Owner Listing].[Unit#],
[Unit Owner Listing].[Combined Name],
[Unit Owner Listing].Address,
[Unit Owner Listing].[Home Phone],
[Unit Owner Listing].[H1 Cell Phone],
[Unit Owner Listing].[H1 E-Mail],
[Unit Owner Listing].[H2 Cell Phone],
[Unit Owner Listing].[H2 E-Mail],
[Unit Owner Listing].[H1 Last Name] & ', ' & [Unit Owner Listing].[H1 First Name] AS [H1 Full Name],
IIF([Unit Owner Listing].[H2 Last Name] IS NOT NULL,
[Unit Owner Listing].[H2 Last Name] & ', ' & [Unit Owner Listing].[H2 First Name],
NULL) AS [H2 Full Name]
FROM [Unit Owner Listing]
WHERE (
(([Unit Owner Listing].[H1 Last Name])<>"")
OR
(([Unit Owner Listing].[H1 Last Name]) Not Like "*SPEC*")
OR
(([Unit Owner Listing].[H1 Last Name]) Not Like "*MODEL*")
)
ORDER BY [Unit Owner Listing].[H1 Last Name];
答案 0 :(得分:4)
查询仍会返回
的记录[H1 Full Name] = SPEC
因为"SPEC"
与"*MODEL*"
不同。我怀疑你想要AND而不是:
WHERE
(
(([Unit Owner Listing].[H1 Last Name])<>"")
AND
(([Unit Owner Listing].[H1 Last Name]) Not Like "*SPEC*")
AND
(([Unit Owner Listing].[H1 Last Name]) Not Like "*MODEL*")
)