Delete characters after a string?

Several of my records contain the string:

<!---- ++++++++++ ----->

with a bunch of characters after. I need to remove everything after that string (including the string).

MySQL isn’t my forte which is why I’m here. :slight_smile: I’ve managed to either select or remove the entire field with every new method I try.

Any help would be appreciated! Thank you!

UPDATE mytable SET mycolumn = NULL WHERE mycolumn LIKE '<!---- ++++++++++ ----->%'

1 Like

Thanks for the response. This didn’t work, it said there were no matches. This is what I used:

UPDATE `table`
   SET `column` = NULL
 WHERE `column` LIKE '<!---- ++++++++++ ----->%'

This is what finally worked for me –

UPDATE `table` 
SET `column` = TRIM(TRAILING SUBSTRING_INDEX(`column`, '<!---- ++++++++++ ----->', -1) 
FROM `column`)
2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.