MySQL关键字搜索?
问题描述:
我在其中有两个关键词google plus
我。怎么可以从我的数据库中搜索时,我有确切的一个词像google
或plus
或两者google plus
,而不是goo
或plu
列。MySQL关键字搜索?
我试图用LIKE
函数来达到我的需要,但没有帮助。
感谢
答
这不是一个关系数据库或者是一个很好的使用。你需要像Lucene这样的可以索引值并允许你进行搜索的东西。
答
试试这个:
SELECT keyword FROM tablename WHERE keyword LIKE '%google%' OR keyword LIKE '%plus%'
答
col LIKE '%google%' OR col LIKE '%plus%' OR col LIKE '%google plus%'
http://dev.mysql.com/doc/refman/5.1/en/regexp.html – ethrbunny 2012-01-01 22:24:09