mysql FULLTEXT search multiple words

前端 未结 2 748
天命终不由人
天命终不由人 2020-12-05 15:20

I\'ve never really heard a straight answer on this one, I just need to FULLTEXT search a couple columns with multiple words \"Firstname Lastname\"

$sql = mys         


        
2条回答
  •  不思量自难忘°
    2020-12-05 16:14

    $sql = mysql_query("SELECT * FROM 
             patient_db WHERE 
             MATCH ( Name, id_number ) 
             AGAINST ('+first_word +second_word +third_word' IN BOOLEAN MODE);");
    

    and if you want to do exact search:

    $sql = mysql_query("SELECT * 
                      FROM patient_db 
                      WHERE MATCH ( Name, id_number ) 
                      AGAINST ('"exact phrase"' IN BOOLEAN MODE);");
    

提交回复
热议问题