Hello. Access 2007.
I have a list of keywords in a table which I wish to exclude from a query result for a particular column.
I can use the expression "Not In(SELECT Excluded FROM tblKeywords)" which works. But how can I exclude the words if they appear anywhere within the column text?
That is, I want to match anywhere within the column.
Thanks, Andy.
Exclude keywords from query 2007
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Exclude keywords from query 2007
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
-
- Administrator
- Posts: 78588
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Exclude keywords from query 2007
Try this:
SELECT * FROM MyTable WHERE ID Not In (SELECT ID FROM MyTable, tblKeywords WHERE ParticularColumn Like "*" & [Excluded] & "*")
MyTable = name of your table
ID = primary key of your table
ParticularColumn: field in which you're looking for the keywords.
SELECT * FROM MyTable WHERE ID Not In (SELECT ID FROM MyTable, tblKeywords WHERE ParticularColumn Like "*" & [Excluded] & "*")
MyTable = name of your table
ID = primary key of your table
ParticularColumn: field in which you're looking for the keywords.
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Re: Exclude keywords from query 2007
That works great. Thanks, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.