user5954196
user5954196

Reputation:

How to use WHERE and LIKE clause with JOIN statement

I'm trying to perform a JOIN on two tables, which works fine by itself. But if I then try to add a WHERE x LIKE '%abc%', it doesn't work.

For example:

SELECT tbd.primarytitle, trd.averagerating  
FROM tbd  
INNER JOIN trd 
ON tbd.tconst = trd.tconst 
WHERE tbd.primarytitle LIKE '%A%'

I've tried going through all kinds of joins, and I've tried parenthesizing the first part and assigning to a table, then performing the WHERE x LIKE on that table, and no luck.

How can I achieve this? I've tried looking at 6-7 articles but none of them address both WHERE and LIKE after a JOIN.

Upvotes: 0

Views: 73

Answers (1)

user5954196
user5954196

Reputation:

The issue is the environment being used for the SQL. In MS Access, you have to use * instead of % for wildcards. Simply switch the two and the query will return records.

Upvotes: 2

Related Questions