A MATCH expression for fulltext search can be used to order results. : MATCH « FullText Search « SQL / MySQL






A MATCH expression for fulltext search can be used to order results.

     

-- The following query returns the five best results.

SELECT *,
MATCH(column1, column2) AGAINST('word1 word2 word3') AS mtch
FROM tablename
HAVING mtch > 0.001
ORDER BY mtch DESC
LIMIT 5;

   
    
    
    
    
  








Related examples in the same category

1.Use MATCH in where statement
2.MATCH(TITLE) AGAINST ('to')
3.Using match in where clause
4.Using match in select statement
5.Using the same match...against clause in select clause and where clause
6.Matches two words
7.Matches two columns
8.Matches two columns in boolean mode
9.Match two words in boolean mode
10.Match against a long sentence
11.Get the numbers and relevance values of the books in which distributed appears in the summary.
12.Get the numbers and titles of the books in which database appears in the title.
13.Get the numbers and titles of the books in which the phrase design implementation appears.
14.You can include additional criteria to narrow the search further.
15.Full-Text Search syntax