Changing entire columns

[expired user #3802]'s profile image [expired user #3802] posted 11 years ago in Feature discussion Permalink
Is there a function allowing the change of an entire column?

For example, I filter my search to hit all entries with the word 'one'. I want to change all of them to contain the word 'two'. There are over 2000 and I do not want to do it manually one by one.

How do I change them all at the same time?

Thanks alot, have a really good day!
jfalch's profile image jfalch posted 11 years ago Permalink
UPDATE myTable
SET myField=REPLACE(myField,"one","two")
WHERE myField LIKE "%one%"
[expired user #3802]'s profile image [expired user #3802] posted 11 years ago Permalink
Thanks! Trying....
[expired user #3802]'s profile image [expired user #3802] posted 11 years ago Permalink
It worked! Although it might have hit 400 entries more than intended :P But I made sure to back up, so I'll be playing a little with this.
I should have asked so much earlier, man this is a time saver! Thanks alot J. Falch!
jfalch's profile image jfalch posted 11 years ago Permalink
for more control, read up on using RLIKE in the WHERE clause.

if you have rights to modify the server´s configuration, for even more control download and install the PREG_xxx PCRE UDF´s, and use e.g. PREG_RLIKE() in the WHERE clause; you will also have to read up on regular expressions in this case.

Please login to leave a reply, or register at first.