mysql replace last characters in string if matched
mysql, replace, tags
Solution
try this:
UPDATE table
SET field=concat(left(field,length(field) -4),'</table>')
Problem
I have a table that has some rogue tags that need replacing The offending string ends `<tr>` and needs replacing with `</table>` Not all record are affected, so I need to find these and then replace them Our skills using Update Replace Where are limited as the characters are not unique within the string but their position is, ie the last 4 characters Have tried using ``` UPDATE table SET field REPLACE (RIGHT(field,4),</table>) ``` but suspec this is over simplified (and also fails)