I checked both of these:
Deleting part of a string in MYSQL
but they're not quite what I need.
I've unfortunately inherited a table with a field full of comma-separated strings with no regard for format or order. It's ugly. Now I need to get rid of a particular part of a string:
So let's say I have a table as such:
Column1 Column2
1 XRR01,MMEX1,XFR44
2 XRR02,MMEX1
3 MMEX1,GH345,XFR45,CFA34
4 NMM22,MMEX1,XFR44
5 MMEX1
6 XFR55
I want to do an UPDATE
to find and delete any instances of MMEX1
from the Column2
field, and keep the other parts intact.
So then I would be left with:
Column1 Column2
1 XRR01,XFR44
2 XRR02
3 GH345,XFR45,CFA34
4 NMM22,XFR44
5 NULL (or blank, doesn't really matter)
6 XFR55
Is this possible?