当前位置:网站首页>[SQL] at a certain correlation with a table of data update another table
[SQL] at a certain correlation with a table of data update another table
2022-07-30 04:16:00 【Is average】
Event
When writing a MySQL statement, I want to implement the function of "using the field value in one table to update the field value in another table"
The two tables are structured as follows:
t1 table:
t2 table:
After querying data, write the following statement:
update t1set aaa=t2.aaafrom t2where bbb=t2.bbb;Error after execution:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from t2 where bbb=t2.bbb' at line 3After querying the data, I found that the above writing method is the writing method of SQL Server, so an error will be reported in MySQL
Similarly written in MySQL:
update t1,t2set t1.aaa=t2.aaawhere t1.bbb=t2.bbb;Summary
In MySQL, use the field value in one table to update the field value in another table:
update tabel_dest,table_srcset tabel_dest.attr = table_src.attrwhere condition;In SQL Server, use the field value in one table to update the field value in another table:
update tabel_destset attr = table_src.attrfrom table_srcwhere condition;边栏推荐
- ospf map
- Tcp programming
- Mysql版本升级,直接复制Data文件,查询特别慢
- Let's learn the layout components of flutter together
- When the EasyNVR platform is cascaded to the EasyCVR, why can't the video be played after a while?
- Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Product (2) Mini Program Function
- 机器学习:知道通过低方差过滤实现降维过程
- MySQL data query (subtotal and sorting)
- RRU, BBU, AAU
- redis分布式锁的原子保证
猜你喜欢

Data Lake: Data Integration Tool DataX

Pytorch框架学习记录2——TensorBoard的使用

新型LaaS协议Elephant Swap给ePLATO提供可持续溢价空间

【Untitled】

The leap second that may cause the next "Millennium Bug" is boycotted by tech giants

(redistribute, special comprehensive experiment ospf area)

Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (7) Interim Inspection Report

Pytorch框架学习记录3——Transform的使用

The implementation and basic operation of sub-database sub-table, ER table, global table, fragmentation rules, global sequence, etc. in MyCat

代码开源设计实现思路
随机推荐
Tcp programming
Pytorch框架学习记录3——Transform的使用
Pytorch framework to study record 6 - the torch. Nn. The Module and the torch nn. Functional. The use of conv2d
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (7) Interim Inspection Report
Pytorch框架学习记录6——torch.nn.Module和torch.nn.functional.conv2d的使用
PyG搭建R-GCN实现节点分类
2022.7.29-----leetcode.593
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (5) Task Book
2022-07-29 Group 4 Self-cultivation class study notes (every day)
Atomic Guarantees of Redis Distributed Locks
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (6) Question Opening Reply PPT
CMake installation and testing
MySQL data query (subtotal and sorting)
Arrays and Structures
How to compare struct, slice, map for equality and the difference between several comparison methods in golang
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (5) Task Book
RRU、BBU、AAU
sqlmap use tutorial Daquan command Daquan (graphics)
【C语言】程序环境和预处理
Reverse Analysis Practice 2