I need to order the results based on the repeatness of the word using mysql.
Here is my sample table
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
Will take an "John" as example. In first row "John" is repeated 5 times, 2 times repeated in second row, 1 time repeated in 3rd row and 8 times repeated in 4th row. I need to show the results based on the count descending.
Select * From table Where name like '%John%' OR keywords like '%John%' OR Description like '%John%'
So it will show in below order
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