MySQL case insensitive search on varbinary field?

一笑奈何 提交于 2019-12-01 16:19:12

问题


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.


回答1:


You can use the CONVERT() function:

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

See also Case Sensitivity in String Searches



来源:https://stackoverflow.com/questions/6807839/mysql-case-insensitive-search-on-varbinary-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!