Skip to content Skip to sidebar Skip to footer

How To Count The Number Of Occurrences Of A Particular Word In A Mysql Blob Text?

I have stored the contents of a text file in a MySQL table as a blob. I want to count the number of occurrences of a particular word from that text. Is there any way I can do that

Solution 1:

Try this

SET @searchthis="lumia"; 
SELECT  CAST((LENGTH(`documents`.`file`) - 
              LENGTH(REPLACE(`documents`.`file`, @searchthis, ""))) /
              LENGTH(@searchthis) AS UNSIGNED
            ) AS searchthis_count
    FROM  documents ;

Post a Comment for "How To Count The Number Of Occurrences Of A Particular Word In A Mysql Blob Text?"