Select where not like query (1 Viewer)

dougmcc1

Registered User.
Local time
Today, 12:41
Joined
Jul 29, 2004
Messages
27
Hi,

I'm trying to create a query that will return strings from one table that don't contain certain words which are located in another table. So I have two tables. One table has a list of strings, and the other table has a list of words. I want the query to return all strings from table A that don't contain any of the words in table B.

I'm guessing the SQl will look something like this:
SELECT string FROM tableA WHERE string NOT LIKE " *words_in_tableB* ";

Thanks.
 
Assuming the following table structures:
TableA
-StringField

TableB
-WordField

Try the following:
Code:
SELECT TableA.*
FROM TableA
WHERE NOT EXISTS (
    SELECT TableB.*
    FROM TableB
    WHERE TableA.StringField Like '*' & TableB.WordField & '*';
);
 
Alternatively, use the Find Duplicates Query Wizard and, once the query has been made, reverse the criteria.
 

Users who are viewing this thread

Back
Top Bottom