当前位置:网站首页>mysql更新数组形式的json串
mysql更新数组形式的json串
2022-06-30 03:50:00 【CSDN问答】
表A中有一字段B存储的是数组形式的json串,如:
[
{
"id":20190926000000213,
"skuCode":"11108893",
"skuName":"测试名称1"
},
{
"id":20190926000000214,
"skuCode":"11108892",
"skuName":"测试名称2"
}
]
现需要批量更新skuCode=11108892对应的skuName
已知可以写sql如下:
update 表名称 set 字段B=replace(字段B,'测试名称2','正式名称')
where json_contains(字段B ,json_object('skuCode','11108892'))
上述sql可以查询出skucode包含11109982的数据并替换测试名称2为正式名称。
但是若存在数据如下:
[
{
"id":20190926000000213,
"skuCode":"11108888",
"skuName":"测试名称21"
},
{
"id":20190926000000214,
"skuCode":"11108892",
"skuName":"测试名称2"
}
]
则skucode为11108888的,name也会被替换,变成正式名称1。
不知道有没有什么别的方案
边栏推荐
- 利用反射整合ViewBinding和ViewHolder
- The 5-year Android development interview took 20 days to join Alibaba
- [note] on May 28, 2022, data is obtained from the web page and written into the database
- UML diagrams and list collections
- Local, locallow and roaming in the appdata folder
- (Reprinted) an article will take you to understand the reproducing kernel Hilbert space (RKHS) and various spaces
- Implementation of property management system with ssm+ wechat applet
- 【常见问题】页面跨域和接口跨域
- The jupyter notebook kernel hangs up frequently and needs to be restarted
- dbt产品初体验
猜你喜欢
Analysis of similarities and differences of various merged features (Union, merge, append, resolve) in ArcGIS
The 5-year Android development interview took 20 days to join Alibaba
dbt产品初体验
【笔记】2022.6.7 数据分析概论
Redis中的SDS理解
Node-RED系列(二八):基于OPC UA节点与西门子PLC进行通讯
Practical debugging skills
MySQL performance optimization (6): read write separation
dotnet-exec 0.5.0 released
C # [advanced part] C # multithreading
随机推荐
Vscode+anaconda+jupyter reports an error: kernel did with exit code
Semantic segmentation resources
Local, locallow and roaming in the appdata folder
How to analyze and solve the problem of easycvr kernel port error through process startup?
[0x0] 校长留的开放问题作业
Laravel9 installation locale
毕业设计EMS办公管理系统(B/S结构)+J2EE+SQLserver8.0
Tidb 6.0: rendre les GRT plus efficaces 丨 tidb Book Rush
Implementation of property management system with ssm+ wechat applet
Litjson parses the generated JSON file and reads the dictionary in the JSON file
【图像融合】基于交叉双边滤波器和加权平均实现多焦点和多光谱图像融合附matlab代码
Magical Union
[punch in - Blue Bridge Cup] day 3 --- slice in reverse order list[: -1]
第2章 控制结构和函数(编程题)
【筆記】AB測試和方差分析
Jour 9 Gestion des scripts et des ressources
Ubuntu20.04 PostgreSQL 14 installation configuration record
【力扣刷题总结】数据库题目按知识点分类总结(持续更新/简单和中等题已完结)
RPC correction
第九天 脚本与资源管理