Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL case insensitive search on varbinary field?

I have a varbinary field id like to do a case-insensitive search on.

I know that the way varbinary fields work prohibits you from doing something like so:

WHERE LOWER(page_title) = LOWER("Gasket")

So is there a way to do this? I imagine I could temporarily cast the field as a varchar or something. But I'm not sure.

like image 711
Adam Meyer Avatar asked Jul 24 '11 15:07

Adam Meyer


1 Answers

You can use the CONVERT() function:

SELECT * FROM mytable WHERE CONVERT(page_title USING latin1) = 'gasket';

See also Case Sensitivity in String Searches

like image 117
Mike Avatar answered Sep 20 '22 17:09

Mike