当前位置:网站首页>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
边栏推荐
- 118. 杨辉三角
- Getting started with MySQL
- Lavarel之环境配置 .env
- LeetCode_ Binary search_ Medium_ 153. Find the minimum value in the rotation sort array
- Show the mathematical formula in El table
- [1] Basic knowledge of ros2 - summary version of operation commands
- 干货|总结那些漏洞工具的联动使用
- Xshell connection server changes key login to password login
- [daily training] 648 Word replacement
- Deep understanding of array related problems in C language
猜你喜欢

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)

Navicat run SQL file import data incomplete or import failed

Enregistrement de la navigation et de la mise en service du robot ROS intérieur (expérience de sélection du rayon de dilatation)

作战图鉴:12大场景详述容器安全建设要求

DID登陆-MetaMask

Dry goods | summarize the linkage use of those vulnerability tools

LeetCode简单题分享(20)

如何让join跑得更快?

Did login metamask
![[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?](/img/fb/17e029b1d955965d7e2e0f58701d91.png)
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
随机推荐
566. 重塑矩阵
2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
PHP - laravel cache
LeetCode简单题分享(20)
干货|总结那些漏洞工具的联动使用
118. Yanghui triangle
Centso7 OpenSSL error Verify return code: 20 (unable to get local issuer certificate)
2022-7-7 Leetcode 844. Compare strings with backspace
Mysql怎样控制replace替换的次数?
THINKPHP框架的优秀开源系统推荐
call undefined function openssl_cipher_iv_length
Is it safe to open an account online now? Which securities company should I choose to open an account online?
作战图鉴:12大场景详述容器安全建设要求
LeetCode_ Binary search_ Medium_ 153. Find the minimum value in the rotation sort array
参数关键字Final,Flags,Internal,映射关键字Internal
Use of polarscatter function in MATLAB
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Ways to improve the performance of raspberry pie
PHP中用下划线开头的变量含义
[daily training -- Tencent select 50] 231 Power of 2