我需要根据使用mysql的单词的重复性来排序结果。在mysql中按特定字数排序
这里是我的样品台
id Name keywords Description
1 John John, USA John is good boy. John, John
2 Alex Alex, John Alex is a friend of john.
3 Rocky John Rocky
4 John John,John John, John, John, John, John
将采取 “约翰” 为例。在第一行中,“约翰”重复5次,第二行重复2次,第三行重复1次,第四行重复8次。我需要根据计数递减来显示结果。
Select * From table Where name like '%John%' OR keywords like '%John%' OR Description like '%John%'
所以会显示下订单
id Name keywords Description
4 John John,John John, John, John, John, John
1 John John, USA John is good boy. John, John
2 Alex Alex, John Alex is a friend of john.
3 Rocky John Rocky
https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html#f unction_match – M0rtiis
这里有一个类似的问题:[count-the-number-of-a-string-in-a-varchar-field](http://stackoverflow.com/questions/12344795/count-the -n-varchar-field) – cars10m