Mysql query check the blob column type in where clause

廉价感情. 提交于 2019-12-11 09:27:15

问题


I found out that CONVERT(object USING utf8) is for converting blob to text, but it doesn't seem efficient in the where clause, like this:

Select * 
from Page 
where CONVERT(Page.page_title USING utf8) = 'AccessibleComputing'

Is this the only way and the correct way? because it is taking too much time. Or should I convert 'AccessibleComputing' to binary in a way and then put it there?


回答1:


I tried this and it worked:

Select * from Page where Page.page_title = 'AccessibleComputing'

I think after all it doesn't need any conversion.




回答2:


Do these work?

Select *, CAST(Page.page_title AS CHAR(10000) CHARACTER SET utf8) AS Tmp
from Page
where Tmp = 'AccessibleComputing'

OR

Select *, CONVERT(Page.page_title USING utf8) AS Tmp
from Page
where Tmp = 'AccessibleComputing'


来源:https://stackoverflow.com/questions/28903599/mysql-query-check-the-blob-column-type-in-where-clause

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