mysql FULLTEXT搜索多个单词
我从来没有真正听到过关于这个问题的直接答案,我只需要FULLTEXT搜索包含多个单词“ Firstname Lastname”的几列
$sql = mysql_query("SELECT * FROM patient_db
WHERE MATCH ( Name, id_number )
AGAINST ('% $term %' IN BOOLEAN MODE);");
但是,如果我在此处输入多个单词,它将无法运行查询。
回答:
$sql = mysql_query("SELECT * FROM patient_db WHERE
MATCH ( Name, id_number )
AGAINST ('+first_word +second_word +third_word' IN BOOLEAN MODE);");
如果要进行精确搜索:
$sql = mysql_query("SELECT * FROM patient_db
WHERE MATCH ( Name, id_number )
AGAINST ('"exact phrase"' IN BOOLEAN MODE);");
以上是 mysql FULLTEXT搜索多个单词 的全部内容, 来源链接: utcz.com/qa/403529.html