怎么替换MYSQL中某字段的内容,参数替换
Jun 23, 2016 pm 01:44 PM 比如内容是
*********.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, '</b>', 1), '<b>', -1))
update tbl_name set field=REPLACE(field, 'haode=yes', CONCAT('type=', SUBSTRING_INDEX(SUBSTRING_INDEX(field, '</b>', 1), '<b>', -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, '</b>', 1), '<b>', -1))
可以给份完整代码吗,真心不懂SQL语句
数据库doudou
表名phome_ecms_news_data_1
字段newstext
.... , -1)) )
少粘了一层括号
搞定了,非常感谢

인기 기사

인기 기사

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Laravel Back End : Part 2, React가있는 React 앱 구축

PHP의 컬 : REST API에서 PHP Curl Extension 사용 방법
