[AccessD] Wildcard Query Problem

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed Aug 13 10:58:16 CDT 2008


I have a query that should not return some records based on the wildcard part of the query for the field COMMENT. Wildcard part of the query is as follows
((SACROC_HeaderDetails.Comment) Not Like "WAS*" Or (SACROC_HeaderDetails.Comment) Not Like "*WAS"))

The query however return records with a comments such as "WAS REQUIREMENT" or  "                                WAS REQUIREMENT"

Below is the SQL of the whole query.

SELECT DISTINCT SACROC_HeaderDetails.METER, Max(SACROC_HeaderDetails.Sample_Date) AS MaxOfSample_Date, dbo_DSS_LastStatus.Status, SACROC_HeaderDetails.Comment
FROM SACROC_HeaderDetails INNER JOIN dbo_DSS_LastStatus ON SACROC_HeaderDetails.METER = dbo_DSS_LastStatus.Completion_name
GROUP BY SACROC_HeaderDetails.METER, dbo_DSS_LastStatus.Status, SACROC_HeaderDetails.Comment
HAVING (((SACROC_HeaderDetails.METER) Like "*-*") AND ((Max(SACROC_HeaderDetails.Sample_Date))<Now()-180) AND ((dbo_DSS_LastStatus.Status)="FH" Or (dbo_DSS_LastStatus.Status)="FL" Or (dbo_DSS_LastStatus.Status)="PH" Or (dbo_DSS_LastStatus.Status)="PL" Or (dbo_DSS_LastStatus.Status)="RH" Or (dbo_DSS_LastStatus.Status)="RP" Or (dbo_DSS_LastStatus.Status)="SH" Or (dbo_DSS_LastStatus.Status)="SP") AND ((SACROC_HeaderDetails.Comment) Not Like "WAS*" Or (SACROC_HeaderDetails.Comment) Not Like "*WAS"))
ORDER BY SACROC_HeaderDetails.METER;

Thanks.


Chester Kaup

Engineering Technician

Kinder Morgan CO2 Company, LLP

Office (432) 688-3797

FAX (432) 688-3799





No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.




More information about the AccessD mailing list