remyremy
remyremy

Reputation: 23

Microsoft Access: why isn't my query from an unrelated table working?

I have a database in Microsoft Access with about 3 million entries. However, I'm only interested in a select amount of entries. I have a list of about 500 words in three different, unrelated tables and I'd only like the database entries in which one of these 500 words occur in their content to show up after my query.

Contents of my database

So far I've been able to look up results one by one with this code:

SELECT DB_timesplit.content
FROM DB_timesplit
WHERE (((DB_timesplit.content) Like "*" & [Enter search term] & "*" ));

I've managed to get results with a practice database with the following:

SELECT testdb.[content], searchdb.[keyword]
FROM testdb INNER JOIN searchdb ON testdb.[content]=[searchdb].[keyword]
WHERE ((([testdb].[content] Like "*" & [searchdb].[keyword] & "*"));

However, whenever I change the values of the practice database to my actual one, I get no results. Could anyone try and explain to me what I'm missing?

Upvotes: 2

Views: 68

Answers (1)

Terry Carmen
Terry Carmen

Reputation: 3876

INNER JOIN searchdb ON testdb.[content]=[searchdb].[keyword]

WHERE ((([testdb].[content] Like "*" & [searchdb].[keyword] & "*"));

Your code will only match where [content] exactly equals [keyword].

The wildcards will never match anything because they're being applied to the results of the INNER JOIN, which only contains complete matches.

If you remove the INNER JOIN, I believe you'll get the results you're expecting.

Upvotes: 1

Related Questions