distal-attribute
distal-attribute
distal-attribute
distal-attribute

Changing entire columns

User, date Message
Written by stjernerlever
1 year ago
Category: Feature discussion
4 posts since Wed, 10 Dec 08
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!
Written by jfalchMoney, Euro
1 year ago
407 posts since Sat, 17 Oct 09
UPDATE myTable
SET myField=REPLACE(myField,"one","two")
WHERE myField LIKE "%one%"
Written by stjernerlever
1 year ago
4 posts since Wed, 10 Dec 08
Thanks! Trying....
Written by stjernerlever
1 year ago
4 posts since Wed, 10 Dec 08
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!
Written by jfalchMoney, Euro
1 year ago
407 posts since Sat, 17 Oct 09
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.