【问题标题】:MySQL keyword search?MySQL关键字搜索?
【发布时间】:2012-01-01 22:18:48
【问题描述】:

我有一列有两个关键字 google plus 。当我有确切的一个词时,我如何从我的数据库中搜索 googleplus 或两者都有 google plus 而不是gooplu

我尝试使用 LIKE 函数满足我的需求,但没有帮助。

谢谢

【问题讨论】:

标签: mysql keyword


【解决方案1】:

试试这个:

SELECT keyword FROM tablename WHERE keyword LIKE '%google%' OR keyword LIKE '%plus%'

【讨论】:

    【解决方案2】:

    这对于关系数据库或 LIKE 来说不是很好的用途。您需要像 Lucene 这样可以索引值并允许您进行搜索的东西。

    【讨论】:

      【解决方案3】:
      col LIKE '%google%' OR col LIKE '%plus%' OR col LIKE '%google plus%'
      

      【讨论】:

        猜你喜欢
        • 2010-10-07
        • 1970-01-01
        • 2011-10-27
        • 2013-04-08
        • 1970-01-01
        • 2019-02-07
        • 2011-09-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多