SQL Find & Replace part of a string

后端 未结 2 1955
失恋的感觉
失恋的感觉 2021-01-22 02:51

I\'m trying to find certain text \"catid=18\" in a string, where each string is different except for this. I\'ve used this query below before, except it only seems to work if yo

相关标签:
2条回答
  • 2021-01-22 03:22

    Not sure if that is what you want. But it will return 1 if catid=any_num is found and 0 if not:

    select 'some_text catid=18 some_text' REGEXP 'catid=[0-9]+'
    
    0 讨论(0)
  • 2021-01-22 03:31

    Maybe you need:

    update TABLE_NAME
    set FIELD_NAME = 'goodvalue'
    WHERE FIELD_NAME = 'badvalue'; 
    
    0 讨论(0)
提交回复
热议问题