I use this to find and replace strings in mySQL:
UPDATE products
SET prodname = REPLACE(prodname, " S", "'S")
Products contain lines such as "TYLENOL TABS 100 S" which I would like to convert to "TYLENOL TABS 100'S".
However, using the above SQL statement also affects strings such as "NIKE SHOES" that will become "NIKE'SHOES", which I clearly don't like.
Is there a way to limit the replacement function (or is there another way to do this) so that I can get the result I want? The "S" is usually at the end of the line for most of my data, and I hope this is useful.
source
share