MySQL : replace occurence of a string in field except first one
问题 I want to update all fields of a column, a lot of them have a desired string in there, but I want this string to be in only each field once, for instance : "MyString OtherString MyString AnotherString AndAnother MyString" to "MyString OtherString AnotherString AndAnother" would you have any idea on how to achieve this ? 回答1: If "MyString" will always occur as the first term in the field, this would work: update MyTable set MyField = replace(MyField, ' MyString','') The key point above is that