从MS Access查询设计器,我到目前为止构建了一个工作查询。
新要求出现在需要进一步过滤查询结果的位置。
SELECT Sum(0) AS [#], Contacts.COMPANY, Proposals.[PROP NAME], Projects.[START DATE], Projects.DESCRIPTION, Projects.[TOTAL FEE], Projects.[PROJ ID], Contacts.[FULL NAME], Projects.COUNTRY
FROM (Contacts INNER JOIN Proposals ON Contacts.[CON ID] = Proposals.[CON ID]) INNER JOIN Projects ON Proposals.[PROP ID] = Projects.[PROP ID]
GROUP BY Contacts.COMPANY, Proposals.[PROP NAME], Projects.[START DATE], Projects.DESCRIPTION, Projects.[TOTAL FEE], Projects.[PROJ ID], Contacts.[FULL NAME], Projects.COUNTRY, Projects.[PROJECT STATUS]
HAVING ((((Proposals.[PROP NAME]) Like "*" & [forms]![TempUI]![SrchText] & "*") ) AND ((Projects.[START DATE]) Between [Forms]![TempUI]![txtRptDateStart] And [Forms]![TempUI]![txtRptDateEnd]) AND ((Projects.[PROJECT STATUS]) Like [forms]![TempUI]![cmb_scope]));
此查询将根据srchtxt(文本框)
的内容过滤记录当srchtxt包含单词" fire"时,让我们假设结果。是这些
Prop Name
----------
Fire Pump repair
Fire damage repair
Wall restructure due to building fire
Fire water pump
Roof repair due to fire
现在我需要进一步过滤这个以排除" pump"因为消防泵是一台机器,与火灾造成损坏的结构无关
我尝试使用AND
NOT LIKE
这样的
HAVING ((((Proposals.[PROP NAME]) Like "*" & [forms]![TempUI]![SrchText] & "*") AND ((Proposals.[PROP NAME]) NOT LIKE [forms]![TempUI]![txtRPTexlude])) AND ((Projects.[START DATE]) Between [Forms]![TempUI]![txtRptDateStart] And [Forms]![TempUI]![txtRptDateEnd]) AND ((Projects.[PROJECT STATUS]) Like [forms]![TempUI]![cmb_scope]));
但它没有结果。
知道什么是正确的HAVING子句从结果中排除所有记录的单词" pump"?
由于
答案 0 :(得分:0)
没有"没有"但您仍然可以尝试使用不存在的条件
SELECT Whatever FROM wherever
WHERE NOT EXISTS (
*Select here*
)