当前位置:网站首页>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。
不知道有没有什么别的方案
边栏推荐
- Half a year after joining the company, I was promoted to a management post
- 学校实训要做一个注册页面,要打开数据库把注册页面输入的内容存进数据库但是
- AppData文件夹下Local,Locallow和Roaming
- dotnet-exec 0.5.0 released
- Chapter 2 control structure and function (programming problem)
- Selenium environment installation, 8 elements positioning --01
- [punch in - Blue Bridge Cup] day 3 --- slice in reverse order list[: -1]
- . Net 7 JWT configuration is too convenient!
- Pytorch Profiler+ Tensorboard + VS Code
- TiDB 6.0:讓 TSO 更高效丨TiDB Book Rush
猜你喜欢

The 5-year Android development interview took 20 days to join Alibaba

December2020 - true questions and analysis of C language (Level 2) in the youth level examination of the Electronic Society

From 2500 a month, no one wants to go to the programming road of the technical director of a large factory | my ten years

Interpretation score of bilstm-crf in NER_ sentence

Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column
![[punch in - Blue Bridge Cup] day 2 --- format output format, ASCII](/img/b2/0059659867e867a32b8e7cef567c8b.jpg)
[punch in - Blue Bridge Cup] day 2 --- format output format, ASCII

Linear interpolation of spectral response function
![C # [advanced part] C # multithreading](/img/16/2a7c477b4cee32d9ce1e543c9d4c7e.png)
C # [advanced part] C # multithreading
![[note] on May 27, 2022, MySQL is operated through pychart](/img/34/36a3765683b2af485ca7c3e366da59.png)
[note] on May 27, 2022, MySQL is operated through pychart

Usage record of unity input system (instance version)
随机推荐
124 articles in total! Motianlun "high availability architecture" dry goods document sharing (including Oracle, mysql, PG)
Practical debugging skills
Interpretation score of bilstm-crf in NER_ sentence
【笔记】2022.6.7 数据分析概论
Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column
How to use FME to create your own functional software
C # [advanced chapter] C # anonymous method [lambda expression to be supplemented...]
yarn的安装和使用
解决navicat连接数据库遇到的问题
Mysql性能优化(5):主从同步原理与实现
Hisense A7 ink screen mobile phone cannot be started
(03).NET MAUI实战 基础控件
接口测试--如何分析一个接口?
【筆記】AB測試和方差分析
MySQL performance optimization (5): principle and implementation of master-slave synchronization
What does the hyphen mean for a block in Twig like in {% block body -%}?
Semantic segmentation resources
From 2500 a month, no one wants to go to the programming road of the technical director of a large factory | my ten years
C#【高级篇】 C# 匿名方法【待补充Lambda表达式。。。】
You know AI, database and computer system