user453984
user453984

Reputation: 133

How to use MySQL fulltext to search for phrases instead of using LIKE

How to use mysql fulltext search to search for phrases instead of like :

SELECT description FROM t WHERE info LIKE "%Search phrase one%" OR  info LIKE "%Phrase second%"  OR info LIKE "%Another phrase with more words%"

Upvotes: 2

Views: 4357

Answers (1)

pit
pit

Reputation: 633

Here's a sample query for searching phrases:

SELECT * FROM table WHERE MATCH ( col1,col2,col3 ) 
AGAINST ('"some words" "another phrase"' IN BOOLEAN MODE);

More infos at : http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

Upvotes: 3

Related Questions