I have got a string like this
****1****2****22****111****3****34****21****33****23****213****213****222****55****152****36
Let's say I have a new number to add to this string like ****44
,
I want to UPDATE
the string and add that number ****44
Only if it is not already in there.
If a number is already there i.e. Suppose I want to add ****22
, the UPDATE
should not happen because ****22
is already in the string.....
However, if I have ****22222
, the UPDATE
should Proceed.
How can this possibly be done:
So far I have this great thoughts from this SO Link: MySQL string replace
However, using this code (got from the SO Link as the Accepted answer there):
UPDATE your_table
SET your_field = REPLACE(your_field, 'articles/updates/', 'articles/news/')
WHERE your_field LIKE '%articles/updates/%'
I dont get how the checking of if the piece already exists will be done cause, this seems to be a direct change from one string to another.
Any Suggestion is honored.