Sql匹配多个单词

时间:2013-07-28 00:05:15

标签: mysql sql match

如何运行查询:

SELECT * FROM contacts WHERE MATCH(firstname,middlename,lastname) AGAINST ('Adam','Dustin')

当我使用两个单词时,例如Adam和Dustin,它失败了,但是当我使用一个单词时它会成功。

2 个答案:

答案 0 :(得分:1)

尝试在行尾添加:IN BOOLEAN MODE(在括号前)

示例:

SELECT * FROM contacts WHERE MATCH(firstname,middlename,lastname)AGAINST('Adam','Dustin'IN BOOLEAN MODE)

再见! :-D

答案 1 :(得分:0)

SELECT * FROM contacts WHERE MATCH(firstname,middlename,lastname) AGAINST ('Adam Dustin')