您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

怎么替换MYSQL中某字段的内容,参数替换

2024/4/10 9:36:01发布12次查看
比如内容是
*********.php?haode=yes********789**********
*********.php?haode=yes********246**********
*********.php?haode=yes********221**********
*********.php?haode=yes********687**********
*********.php?haode=yes********215**********
需要替换成
*********.php?type=789********789**********
*********.php?type=246********246**********
*********.php?type=221********221**********
*********.php?type=687********687**********
*********.php?type=215********215**********
回复讨论(解决方案) ?abc替1,2,3
update table set fields = replace(fields, 'abc', '123');
?abc替1,2,3
update table set fields = replace(fields, 'abc', '123');
我主要是要把后面的哪数字复制到前面来呀 update tbl_name set field=replace(field, 'haode=yes', concat('type=', substring_index(substring_index(field, '', 1), '', -1))


update tbl_name set field=replace(field, 'haode=yes', concat('type=', substring_index(substring_index(field, '', 1), '', -1))


#1064 - you have an error in your sql syntax; check the manual that corresponds to your mysql server version for the right syntax to use near '' at line 2
.... , -1)) )
少粘了一层括号
update tbl_name set field=replace(field, 'haode=yes', concat('type=', substring_index(substring_index(field, '', 1), '', -1))


可以给份完整代码吗,真心不懂sql语句
数据库doudou
表名phome_ecms_news_data_1
字段newstext
.... , -1)) ) 
少粘了一层括号
搞定了,非常感谢
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product