I am trying to write the following statement without the SQL OR:
SELECT * FROM table WHERE names LIKE 'john%' OR names LIKE 'brian%'
So, I don't want to use OR because the names in my real problem are too many, but I also don't want to use REGEXP. How is the LIKE syntax? Thank you in advance!
I don't want to use REGEXP because some names are in square brackets and others or not. And this make it too complicated. I just want to know if there is a syntax similar to 'REGEXP '^(".implode("|", $names_array).")[[:>:]]'";' using LIKE
SELECT * FROM table WHERE LEFT(names, 4) = 'john' OR LEFT(names, 5) = 'brian'as this should cover your needs?LIKEand notREGEXP? You cannot do what you want withLIKE,LIKEonly have_(one character) and%(any characters) symbol, you won't be able to create anything similar to aORusingLIKE.