当前位置:网站首页>MySQL uses the method of updating linked tables with update
MySQL uses the method of updating linked tables with update
2022-07-03 11:43:00 【Never stop chasing dreams】
One 、 Preface
Before that java In the code , branch 2 step :
1. Use select Query a result set
2. According to this result set , Use update Method to update the database
Two 、sql
Now you need not to change the code , use sql To achieve this step , A sample of :
update a cs inner join
(
SELECT cs.class_id,cs.user_id FROM a cs,b ss
WHERE cs.class_id = ss.classid AND cs.user_id = ss.user_id
AND cs.isDel IS NULL
AND ss.num >=10
) rrr on cs.user_id=rrr.user_id and cs.class_id=rrr.class_id
set cs.type = '1';
explain :
1.sql There is a piece in it , First, query a qualified result set
2. And then update a surface , Use the data in the qualified result set , Put the right a Exterior and interior type Change to 1.
3、 ... and 、 remarks
There's another way , You can put the qualified a Tabular id Find out , And then update a Tabular type when , according to id to update , Use multiple update Statement or use in Any sentence will do .
边栏推荐
- How to get started embedded future development direction of embedded
- 错排问题 (抽奖,发邮件)
- Cadence background color setting
- repo ~ 常用命令
- STL教程10-容器共性和使用场景
- Hongmeng third training (project training)
- Xml的(DTD,xml解析,xml建模)
- phpcms 提示信息页面跳转showmessage
- Gut | 香港中文大学于君组揭示吸烟改变肠道菌群并促进结直肠癌(不要吸烟)
- Program process management tool -go Supervisor
猜你喜欢

The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.

GCC compilation process and dynamic link library and static link library

2022 东北四省赛 VP记录/补题

How to clean up v$rman_ backup_ job_ Details view reports error ora-02030

Numpy np.max和np.maximum实现relu函数

STL教程10-容器共性和使用场景

Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation

Xml的(DTD,xml解析,xml建模)

软考中级软件设计师该怎么备考

Kibana - installation and configuration of kibana
随机推荐
AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...
Web security summary
一文搞懂Go语言Context
CSRF
ArcGIS应用(二十一)Arcmap删除图层指定要素的方法
R语言使用data.table包进行数据聚合统计计算滑动窗口统计值(Window Statistics)、计算滑动分组中位数(median)并合并生成的统计数据到原数据集中
Viewing binary bin files with notepad++ editor
用了这么久线程池,你真的知道如何合理配置线程数吗?
uniapp实现点击加载更多
How to make others fear you
Gut | Yu Jun group of the Chinese University of Hong Kong revealed that smoking changes intestinal flora and promotes colorectal cancer (do not smoke)
Double linked list of linear list
OpenStack中的测试分类
typeScript
解决msvcp120d.dll和msvcr120d.dll缺失
CSRF
How to become a senior digital IC Design Engineer (1-4) Verilog coding syntax: expression
This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system
Analysis of EPS electric steering system
抓包整理外篇fiddler———— 会话栏与过滤器[二]