Is there a way to combine IN and LIKE in MySQL?
Posted
by abeger
on Stack Overflow
See other posts from Stack Overflow
or by abeger
Published on 2010-05-24T20:29:32Z
Indexed on
2010/05/24
20:31 UTC
Read the original article
Hit count: 250
I'm currently running a query like this:
SELECT *
FROM email
WHERE email_address LIKE 'ajones@%'
OR email_address LIKE 'bsmith@%'
OR email_address LIKE 'cjohnson@%'
The large number of OR
's bothers me. Is there a way to condense this up with something akin to an IN
operator, e.g.:
SELECT *
FROM email
WHERE email_address LIKE ('ajones@%', 'bsmith@%', 'cjohnson@%')
Or is this just wishful thinking?
© Stack Overflow or respective owner