Removing partial data from a field in MySQL

I'm trying to remove a specific set of data from a MySQL database field, however I'm not sure what would be the best expression for that. For example, if I have data in a field like ...

Using a secondary password will allow you to access your account from an unauthenticated computer. An unauthenticated computer is any computer that is not your primary computer, a selected authenticated computer, or a computer that automatically deletes cookies. <p>This is a test</p>

... and I want to remove <p>This is a test</p>

from the field which statement would be better?

+2


a source to share


1 answer


I personally recommend the REPLACE line function: http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_replace



UPDATE table SET fieldname = REPLACE(fieldname, '<p>This is a test</p>', '');

      

+4


a source







All Articles