MySQL源氏boy 2019-04-04
将cdb_pms表subject字段中的Welcom to替换成 欢迎光临
代码如下:
UPDATE `cdb_pms` 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` = TRIM(`pro_pub_time`)
代码如下:
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` = 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
代码如下:
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
代码如下:
UPDATE `es_product` SET `pro_pub_time` = CONCAT( `pro_pub_time`, '-01') WHERE INSTR(`pro_pub_time`,'-') > 0 AND LENGTH(`pro_pub_time`) < 8
代码如下:
UPDATE `es_product` SET `pro_pub_time` = CONCAT(`pro_pub_time`,'-01-01') WHERE INSTR(`pro_pub_time`,'-') = 0 AND LENGTH(`pro_pub_time`) = 4
代码如下:
UPDATE `es_product` SET `pro_pub_time` = DATE_FORMAT(`pro_pub_time`,'%Y年%m月') WHERE INSTR(`pro_pub_time`,'-') > 0