需要使用无空格词搜索值

时间:2014-02-21 09:05:11

标签: php mysql

我需要使用搜索关键词'galaxysduos'搜索'Galaxy S Duos'这样的单词。请在PHP Mysql Query中为我提供解决方案。

2 个答案:

答案 0 :(得分:2)

SELECT * FROM yourTable WHERE REPLACE(fieldname," ","")="galaxysduos"

答案 1 :(得分:0)

试试这个添加@Hanky回答的一些修改

SELECT * FROM `yout_table` WHERE LOWER(REPLACE(`your_field`," ",""))="galaxysduos"

OR

SELECT * FROM `yout_table` WHERE REPLACE(LOWER(`your_field`)," ","")="galaxysduos"