0

我在一个项目中使用全文搜索。我想搜索多个单词,但我遇到了问题。所以我的查询是;

SELECT MAX(id)
FROM table
WHERE MATCH (col1,col2) AGAINST ('+(word1) +(word2) +(word3 word4)')
GROUP BY col1
ORDER BY 1 desc limit 12

这个查询是搜索包括 word1 OR word2 OR word3 OR word4 但我想搜索包括 word1 OR word2 OR word3 word4

那么解决方案是什么?

4

2 回答 2

0

You can try something like this one...

SELECT MAX(id) FROM table WHERE MATCH(colname1,colname2) AGAINST("keyword to search")  GROUP BY colname ORDER BY colname desc limit 12

Reference

于 2012-12-29T11:05:21.393 回答
-1
SELECT * FROM `user_profiles` 
WHERE MATCH (`first_name`,`last_name`) 
      AGAINST ('(+bruce+wayne)(+clark+kent)' IN BOOLEAN MODE)
于 2018-07-05T09:18:18.113 回答