1
(click on this box to dismiss)
What SQL statement can I use for contains?
I want to select all the rows that contain a substring, how can I do this fast? I have an index on the column that I'm testing.
1
Answer
0
How about using LOCATE or POSITION functions?
SELECT * from my_table
WHERE LOCATE('phrase', title) > 0;
0 is returned if the title column does not contain the phrase.
I should also mention that these functions are case-sensitive. See the manual for more information http://www.cubrid.org/manual/840/en/LOCATE%20Function.
asked 2 years ago
viewed 505 times