当前位置:网站首页>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
边栏推荐
- Is it safe to open an account online now? Which securities company should I choose to open an account online?
- 高等数学---第八章多元函数微分学1
- Huawei image address
- Getting started with cinnamon applet
- Build a secure and trusted computing platform based on Kunpeng's native security
- Split screen bug notes
- What parameters need to be reconfigured to replace the new radar of ROS robot
- LeetCode简单题分享(20)
- THINKPHP框架的优秀开源系统推荐
- How far can it go to adopt a cow by selling the concept to the market?
猜你喜欢
JS slow motion animation principle teaching (super detail)
使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )
Battle Atlas: 12 scenarios detailing the requirements for container safety construction
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
Navicat run SQL file import data incomplete or import failed
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
"New red flag Cup" desktop application creativity competition 2022
How far can it go to adopt a cow by selling the concept to the market?
118. Yanghui triangle
Redis 核心数据结构 & Redis 6 新特性详
随机推荐
What parameters need to be reconfigured to replace the new radar of ROS robot
云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)
Distributed transaction solution
mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
Battle Atlas: 12 scenarios detailing the requirements for container safety construction
[daily training -- Tencent select 50] 231 Power of 2
Did login metamask
参数关键字Final,Flags,Internal,映射关键字Internal
为租客提供帮助
供应链供需预估-[时间序列]
Help tenants
PHP - laravel cache
LeetCode_ Binary search_ Medium_ 153. Find the minimum value in the rotation sort array
Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
648. Word replacement: the classic application of dictionary tree
MySQL error 28 and solution
LeetCode_二分搜索_中等_153.寻找旋转排序数组中的最小值
使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )
Milkdown control icon