How would I use a IN table with like? So that I could use % in them? By in I mean:
SELECT fields
FROM table
WHERE age = "50"
AND name IN ("tim", "bob", "nancy", "john");
I already tried:
SELECT fields
FROM table
WHERE age = "50"
AND name LIKE ("2010-09-17%", "2010-09-16%")
But it gave the error "Operand should contain 1 column(s)"
Put the values in a table (
MyParamsTable
) and useLIKE
in aJOIN
condition e.g. something like:You can use a number of LIKE expressions:
or you can use a regex:
or, cleverly
There is no combination of the LIKE and IN clauses. It's either one, or the other, syntax:
The alternative to consider when searching text is Full Text Search (FTS):
...but this requires MyISAM tables, and Full Text Indexing.