像 MySQL 中区分大小写
我有一个 MySQL 查询:
I have a MySQL query:
SELECT concat_ws(title,description) as concatenated HAVING concatenated LIKE '%SearchTerm%';
我的表使用 MyISAM 编码为 utf8_general_ci.
And my table is encoded utf8_general_ci with MyISAM.
搜索似乎区分大小写.
我不知道如何修复它.出了什么问题和/或我该如何解决?
I can't figure out how to fix it. What's going wrong and/or how do I fix it?
推荐答案
试试这个:
SELECT LOWER(CONCAT_WS(title,description)) AS concatenated
WHERE concatenated LIKE '%searchterm%'
或(让你看出区别)
SELECT LOWER(CONCAT_WS(title,description)) AS concatenated
WHERE concatenated LIKE LOWER('%SearchTerm%')
相关文章