Mysql : Count the characters in a column

Hi,

Help me out in writing a query to count the character ‘<p>’ in the text_val coumn in the table “articles”. And select the rows if count of ‘<p>’ is only 2.

SELECT *
  FROM articles
 WHERE LENGTH(text_val) -
       LENGTH(REPLACE(text_val,'<p>',''))
     = 6

:cool: