mysql中使用replace替换某字段的部分内容
作者:hebedich 时间:2024-01-20 14:43:39
最近有个朋友提到如何使用sql来删除一个字段中部分内容,于是就写了这篇文章,简单记过:
测试表如下:
CREATE TABLE `t` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`domain` tinytext,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8
插入测试内容:
INSERT INTO t(domain) VALUES ('j054,j020,mc032,her302')
替换表内容:
UPDATE t SET domain = (REPLACE(domain, ',her302', '')) WHERE id = 1
查看替换结果
标签:mysql,replace
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python的字典和列表的使用中一些需要注意的地方
2023-01-09 02:03:52
Python用20行代码实现完整邮件功能
2023-04-06 12:20:49
![](https://img.aspxhome.com/file/2023/6/105756_0s.gif)
python 实现删除文件或文件夹实例详解
2021-03-23 03:16:37
python实现linux下使用xcopy的方法
2022-08-16 07:52:09
python获取一组数据里最大值max函数用法实例
2022-01-28 00:02:44
python中requests爬去网页内容出现乱码问题解决方法介绍
2023-09-14 01:00:11
请谨慎对待程序的图标和名称
2011-06-16 20:35:22
微信小程序如何修改本地缓存key中单个数据的详解
2024-05-09 10:34:57
![](https://img.aspxhome.com/file/2023/7/126857_0s.png)
Pytorch 使用不同版本的cuda的方法步骤
2023-02-06 07:52:23
![](https://img.aspxhome.com/file/2023/3/114503_0s.png)
Tableau连接mysql数据库的实现步骤
2024-01-21 20:50:41
![](https://img.aspxhome.com/file/2023/1/74781_0s.jpg)
如何解决springboot数据库查询时出现的时区差异问题
2024-01-26 01:53:01
python matplotlib:plt.scatter() 大小和颜色参数详解
2021-09-26 04:56:28
![](https://img.aspxhome.com/file/2023/4/93474_0s.jpg)
anconda的pip下载包出现的问题解决
2022-06-21 22:17:33
![](https://img.aspxhome.com/file/2023/5/131285_0s.jpg)
python实现合并多个list及合并多个django QuerySet的方法示例
2023-11-25 06:43:13
php session处理的定制
2023-11-15 18:38:12
Mysql中mvcc各场景理解应用
2024-01-24 19:29:07
FP-growth算法发现频繁项集——构建FP树
2022-04-26 16:22:52
![](https://img.aspxhome.com/file/2023/1/133541_0s.png)
原生js实现查找/添加/删除/指定元素的class
2024-04-18 09:44:46
python使用selenium打开chrome浏览器时带用户登录信息实现过程详解
2023-07-19 05:00:37
![](https://img.aspxhome.com/file/2023/8/60298_0s.jpg)
Python 计算机视觉编程进阶之OpenCV 图像锐化及边缘检测
2021-07-31 11:03:29
![](https://img.aspxhome.com/file/2023/8/105308_0s.png)