troubleshooting Question

Many NOT LIKE conditions in a Totals Query

Avatar of Davisro
DavisroFlag for United States of America asked on
Microsoft AccessSQL
4 Comments1 Solution87 ViewsLast Modified:

In the following Sql, if I have two NOT LIKE conditions in the HAVING clause.
SELECT [CONCUR 2018_01-04].TripNumber, [CONCUR 2018_01-04].BusinessPurpose
FROM [CONCUR 2018_01-04]
GROUP BY [CONCUR 2018_01-04].TripNumber, [CONCUR 2018_01-04].BusinessPurpose
HAVING ((([CONCUR 2018_01-04].BusinessPurpose) Not Like "*Party*" And ([CONCUR 2018_01-04].BusinessPurpose) Not Like "*Flowers*"));
1.  If I have 40 or 50 NOT LIKE conditions, is there a better way to write the query than writing so many expressions in the HAVING clause
2. Is there a way to manage the NOT LIKE keywords in another table (that users can add to the list on a form) and have the keywords feed into the NOT LIKE conditions in the query?

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros