IN and LIKE command combination, Possible?

L

Lim Heng Sin

In the WHERE clause....

..... where area = "india" or area "china"

can be equivalent to:

where area IN("india","china").

What if:
where area like "a*" or area like "b*"

How to put the Like and IN command together

I'm trying to optimize the query because there are many
records
 
M

Michel Walsh

Hi,



Put the alternatives in a table, alts, one field, alt:

alts ' table name
alt ' field name
a*
b*
' data sample ( 2 rows)



WHERE table1.field1 LIKE alts.alt



(you can use a join rather than a WHERE clause, if you prefer, since you
technically involve two different tables, that is a join).



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top