How to query to get count of matching words in a field, specifically in MySQL. simply i need to get how many times a ‘search terms’appear in the field value.
for example, the value is ‘one two one onetwo’ so when i search for word ‘one’ it should give me 3
is it possible? because currently i just extract the value out of database and do the counting with server side language.
Thank you
You could create a function to be used directly within SQL, in order to do it all in one step.
Here is a function which I found on the MySQL website :
You should use it like this :