Reputation:
Is it possible to use LIKE
with an if statement, like so:
SELECT orders.[order#]
FROM orders
WHERE orders.[order#] LIKE *(SELECT .. FROM .. WHERE .. = ..)*
The statement above results in a syntax error in Access 2016.
Upvotes: 0
Views: 262
Reputation: 107767
Consider an implicit join using LIKE
statement (or cross join with filter):
SELECT orders.[order#]
FROM orders, (SELECT .. FROM .. WHERE .. = ..) AS t
WHERE orders.[order#] LIKE '*' & t.Col & '*'
Upvotes: 0
Reputation: 1271013
You can use a correlated subquery for this:
SELECT o.[order#]
FROM orders o
WHERE EXISTS (SELECT 1
FROM . . .
WHERE o.[order#] LIKE <whatever>
);
Upvotes: 2