当前位置:网站首页>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 .
边栏推荐
- [OBS] configFile in ini format of OBS
- R语言使用gridExtra包的grid.arrange函数将lattice包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
- JGG专刊征稿:时空组学
- 优化接口性能
- MCDF实验1
- R语言使用gridExtra包的grid.arrange函数将ggplot2包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
- How to become a senior digital IC Design Engineer (1-5) Verilog coding syntax: operand
- Mmc5603nj geomagnetic sensor (Compass example)
- Keepalived中Master和Backup角色选举策略
- 基于turtlebot3实现SLAM建图及自主导航仿真
猜你喜欢

VS2015的下载地址和安装教程

ASP. Net hotel management system

PHP server interacts with redis with a large number of close_ Wait analysis

Spl06-007 air pressure sensor (example of barometer)

FL Studio 20 unlimited trial fruit arranger Download

PHP基础

Arctangent entropy: the latest SCI paper in July 2022

2022年湖南工学院ACM集训第二次周测题解

牛牛的组队竞赛

AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...
随机推荐
Analysis of EPS electric steering system
R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g
How to clean up v$rman_ backup_ job_ Details view reports error ora-02030
Stm32hal library upgrades firmware based on flash analog U disk (detailed explanation)
CSRF
MySQL union和union all区别
Web安全总结
外插散点数据
Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power
Nestjs configuration service, configuring cookies and sessions
Cadence background color setting
Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation
The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
2022年中南大学夏令营面试经验
The excel table is transferred to word, and the table does not exceed the edge paper range
mysql使用update联表更新的方法
Multi dimensional monitoring: the data base of intelligent monitoring
R语言使用aggregate函数计算dataframe数据分组聚合的均值(sum)、不设置na.rm计算的结果、如果分组中包含缺失值NA则计算结果也为NA
Excel表格转到Word中,表格不超边缘纸张范围
Excel快速跨表复制粘贴