日期:2014-05-16 浏览次数:20881 次
更新前的查寻:
?
SELECT o.description from product_info o WHERE o.description LIKE '%HELLO KITTY%'
?
SELECT o.`name` from product_info o WHERE INSTR(`name`,'HELLO KITTY') > 0
?
?
我的更新:
UPDATE `product_info`
SET `description` = REPLACE(`description`, 'Hello Kitty', 'Kitty')
WHERE INSTR(`description`,'Hello Kitty') > 0
注意:查寻时是不区分大小写的,但替换更新时有区分大小写。
?
?
?
?
?
将cdb_pms表subject字段中的Welcom to替换成 欢迎光临 UPDATE `cdb_pms` 替换cdb_posts表的message字段,将“viewthread.php?tid=3989”替换成“viewthread.php?tid=16546” ? 删除所有的空格 UPDATE `es_product`?? SET `pro_pub_time` = TRIM(`pro_pub_time`) 删除所有饱含'['或者']'或者'.'的字符UPDATE `es_product`?? SET `pro_pub_time` = REPLACE(`pro_pub_time`, '[','')?? WHERE INSTR(`pro_pub_time`,'[') > 0 ? 替换所有含中文'-'的为英文'-' 将所有的年月都替换成'-' 将所有'2005-04-'这种类型的替换成'2005-04-01' 将所有'2005-'这种类型替换成'2005-01-01' UPDATE `es_product`?? SET `pro_pub_time` = CONCAT( `pro_pub_time`, '01-01') WHERE INSTR(`pro_pub_time`,'-') > 0 AND?? LENGTH(`pro_pub_time`) = 5 将所有 饱含'-',但是位数小于8的改成追加'-01' UPDATE `es_product`?? SET `pro_pub_time` = CONCAT( `pro_pub_time`, '-01') WHERE INSTR(`pro_pub_
SET `subject` = REPLACE(`subject`, 'Welcome to', '欢迎光临')
WHERE INSTR(`subject`,'Welcome to') > 0
UPDATE `cdb_posts`
SET `message`= REPLACE(`message`, 'viewthread.php?tid=3989', 'viewthread.php?tid=16546')
WHERE INSTR(`message`,'viewthread.php?tid=3989') > 0 ;
UPDATE `es_product`?? SET `pro_pub_time` = REPLACE(`pro_pub_time`, ']','')?? WHERE INSTR(`pro_pub_time`,']') > 0
UPDATE `es_product`?? SET `pro_pub_time` = REPLACE(`pro_pub_time`, '.','-')?? WHERE INSTR(`pro_pub_time`,'.') > 0
UPDATE `es_product`?? SET `pro_pub_time` = REPLACE(`pro_pub_time`, '-','-')?? WHERE INSTR(`pro_pub_time`,'-') > 0
UPDATE `es_product`?? SET `pro_pub_time` = REPLACE(`pro_pub_time`, '年','-')?? WHERE INSTR(`pro_pub_time`,'年') > 0
UPDATE `es_product`?? SET `pro_pub_time` = REPLACE(`pro_pub_time`, '月','-')?? WHERE INSTR(`pro_pub_time`,'月') > 0
UPDATE `es_product`?? SET `pro_pub_time` = CONCAT( `pro_pub_time`, '01')?? WHERE SUBSTRING_INDEX( `pro_pub_time`, '-', -1) = '' AND LENGTH(`pro_pub_time`) > 0 AND LENGTH(`pro_pub_time`) > 5