当前位置:网站首页>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
边栏推荐
- The reason why data truncated for column 'xxx' at row 1 appears in the MySQL import file
- Mysql怎样控制replace替换的次数?
- Flink | 多流转换
- Drawerlayout suppress sideslip display
- Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
- 供应链供需预估-[时间序列]
- 云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
- Split screen bug notes
- How to make join run faster?
- 118. Yanghui triangle
猜你喜欢
Flink | multi stream conversion
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
118. 杨辉三角
[dark horse morning post] Huawei refutes rumors about "military master" Chen Chunhua; Hengchi 5 has a pre-sale price of 179000 yuan; Jay Chou's new album MV has played more than 100 million in 3 hours
2022-7-6 Leetcode27. Remove the element - I haven't done the problem for a long time. It's such an embarrassing day for double pointers
数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
【堡垒机】云堡垒机和普通堡垒机的区别是什么?
2022-7-7 Leetcode 844. Compare strings with backspace
Ways to improve the performance of raspberry pie
随机推荐
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
Toraw and markraw
Parameter keywords final, flags, internal, mapping keywords internal
Leetcode simple question sharing (20)
Ogre introduction
Custom thread pool rejection policy
648. 单词替换 : 字典树的经典运用
LeetCode简单题分享(20)
566. 重塑矩阵
Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
What are the principles for distinguishing the security objectives and implementation methods that cloud computing security expansion requires to focus on?
PostgreSQL array type, each splice
mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
postgresql array类型,每一项拼接
SSRF漏洞file伪协议之[网鼎杯 2018]Fakebook1
3D Detection: 3D Box和点云 快速可视化
室內ROS機器人導航調試記錄(膨脹半徑的選取經驗)
Talk about pseudo sharing
MySQL error 28 and solution
云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?