开发者

Simplifying mysql fulltext search

开发者 https://www.devze.com 2023-01-09 22:42 出处:网络
To do text search for wordA, wordB and wordC right now I\'m doing it this way: SELECT * FROM mytable WHERE

To do text search for wordA, wordB and wordC right now I'm doing it this way:

SELECT * FROM 
    mytable 
WHERE
    MATCH (field1) AGAINST ('wordA' IN BO开发者_开发百科OLEAN MODE) OR
    MATCH (field1) AGAINST ('wordB' IN BOOLEAN MODE) OR
    MATCH (field1) AGAINST ('wordC' IN BOOLEAN MODE)

Is there a more compact way of writing this?


Just worked out this will work too

SELECT * FROM 
    mytable 
WHERE
    MATCH (field1) AGAINST ('wordA/wordB/wordC' IN BOOLEAN MODE)
0

精彩评论

暂无评论...
验证码 换一张
取 消