网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   MySQL (https://www.0058.net/forumdisplay.php?f=76)
-   -   how to find and replace a word in a mysql column? (https://www.0058.net/showthread.php?t=5379)

Maribel 2015-12-19 10:59 PM

how to find and replace a word in a mysql column?
 
I have a column containing list of streets. I need to replace 'eyeglasses' with 'glasses'. The replacement can be made in the current column or in a new column with the address in the required format. The following is the sample data. 'Column 1' contains the data in current format. 'Column 2' contains the data in the desired format.
Code:

Column 1        Column 2
cheap eyeglasses  cheap glasses
sports sunglasses      sports sunglasses
discount eyeglasses  discount glasses

There are about 1000 products at www.bestpriceglasses.com, if modify one by one, too much trouble. I think it is really a good idea if I can modify via MySQL command.

New Britain 2015-12-19 11:02 PM

This query works for this:
Code:

UPDATE table SET column = REPLACE(column, 'eyeglasses', 'glasses');


All times are GMT +8. The time now is 06:06 AM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.