Count the number of occurrences of a string in a VARCHAR field?

后端 未结 7 1162
花落未央
花落未央 2020-11-22 07:51

I have a table like this:

TITLE          |   DESCRIPTION
------------------------------------------------
test1          |   value blah blah value
test2              


        
7条回答
  •  旧时难觅i
    2020-11-22 08:38

    try this:

     select TITLE,
            (length(DESCRIPTION )-length(replace(DESCRIPTION ,'value','')))/5 as COUNT 
      FROM 


    SQL Fiddle Demo

    提交回复
    热议问题