当前位置:网站首页>How does MySQL control the number of replace?
How does MySQL control the number of replace?
2022-07-07 13:51:00 【Full stack programmer webmaster】
I want to put “ABC yes ABC” Replace with “123 yes ABC”, That is to find the first one ABC Replace with 123,MYSQL How the order should be written ?
UPDATE data SET body=REPLACE(body, ‘ABC’, ‘123’); When I use this command, I will put all ABC Are replaced with 123, I don't know how to control the number of replacements , Ask an expert for advice .
hemu780924 Brother's code can be used , But there is a fatal flaw ,
such as "123 yes ABC", If you want to find XYZ And replace it with OPQ, Because in "123 yes ABC" Can't find XYZ, Then the order will be "123 yes ABC" Insert in front XYZ, This is not what I want !
update table1 set body =
concat(
SUBSTRING(body ,1,position('ABC' in body )-1),
'123',
substring(body ,position('ABC' in body )+length('ABC'))) where body like '%ABC%'
Here replace the first ABC , No, ABC No replacement
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113283.html Link to the original text :https://javaforall.cn
边栏推荐
- Milkdown control icon
- Flink | 多流转换
- Leetcode simple question sharing (20)
- [fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
- Digital IC Design SPI
- Introduction and basic use of stored procedures
- 内存溢出和内存泄漏的区别
- 【日常训练--腾讯精选50】231. 2 的幂
- 华为镜像地址
- Navicat运行sql文件导入数据不全或导入失败
猜你喜欢
Navicat run SQL file import data incomplete or import failed
Xshell connection server changes key login to password login
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
Build a secure and trusted computing platform based on Kunpeng's native security
The delivery efficiency is increased by 52 times, and the operation efficiency is increased by 10 times. See the compilation of practical cases of financial cloud native technology (with download)
Use of polarscatter function in MATLAB
Getting started with MySQL
Flink | multi stream conversion
Ogre introduction
SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1
随机推荐
High end for 8 years, how is Yadi now?
云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
Navicat运行sql文件导入数据不全或导入失败
《厌女:日本的女性嫌恶》摘录
【日常训练】648. 单词替换
Is it safe to open an account online now? Which securities company should I choose to open an account online?
Milkdown control icon
Leetcode simple question sharing (20)
The delivery efficiency is increased by 52 times, and the operation efficiency is increased by 10 times. See the compilation of practical cases of financial cloud native technology (with download)
华为镜像地址
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
[daily training -- Tencent select 50] 231 Power of 2
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
What are the principles for distinguishing the security objectives and implementation methods that cloud computing security expansion requires to focus on?
Use of polarscatter function in MATLAB
得物客服热线的演进之路
Detr introduction
DID登陆-MetaMask
高等數學---第八章多元函數微分學1
Esp32 ① compilation environment