I am parsing an input text field and creating the following SQL statement which I was wondering if it could be simplifed. It works a treat by the way
SELECT *
FROM cities2 WHERE concat(name, " ", state_name) LIKE ?
AND concat(name, " ", state_name) LIKE ?
AND concat(name, " ", state_name) LIKE ?
Params: array( "%as%", "%ta%", "%ba%" );
AFAIK MySQL is case insensitive - except maybe if the collation is “_cs_” and not “_ci_”
What scared me away from trying was
Warning
The REGEXP and RLIKE operators work in byte-wise fashion, so they are not multibyte safe and may produce unexpected results with multibyte character sets. In addition, these operators compare characters by their byte values and accented characters may not compare as equal even if a given collation treats them as equal.
But they should work against the transliteration field OK as long as the input isn’t multi-byte