russellmania
russellmania

Reputation: 749

MS Access Query Logic

I know nothing about MS Access but am trying to help a colleague. They have a database with job titles and he wants to find anyone who is a CEO but not anyone that is an "Assistant to the CEO." Some titles are "CEO", "CEO & Founder", "CEO & CTO", etc. Some of the titles he doesn't want are "Assistant to the CEO", "Administrative Assistant to the CEO", etc. I think the query

(Like "*CEO*") AND (Like "assis*")

should return titles that are not the former titles I mentioned, but Access returns nothing.

Upvotes: 1

Views: 76

Answers (1)

Matt Hall
Matt Hall

Reputation: 2412

On a dataset like this:

enter image description here

The following query...

SELECT tblJobTitle.[JobTitle]
FROM tblJobTitle
WHERE tblJobTitle.[JobTitle] Like "*CEO*" And tblJobTitle.[JobTitle] Not Like "*to the CEO*"

..returns:

enter image description here

...you may want to define more strings to exclude (JobTitle Not Like...) depending on what your data is looking like.

Upvotes: 3

Related Questions