views:

59

answers:

2

hello,

i have this table in UTF8 (collation is utf8_bin in case it matters).

I need to search in it for strings using LIKE '%$searchstring%' .

Right now you have to use the exact case in order for the results to show up. Is there a way to make it case insensitive ?

Thank you

UPDATE sorry, found the answer.

A: 

Your collation specifies the case-sensitivity. Use this instead:

utf8_ci

AJ
+2  A: 

Use:

WHERE LOWER(t.column) LIKE LOWER('%search_string%')

..or:

WHERE UPPER(t.column) LIKE UPPER('%search_string%')

References:

OMG Ponies
according to http://stackoverflow.com/questions/234591/upper-vs-lower-case/234751#234751, comparison with 'lower' or 'upper' can be incorrect for some languages
akavel