Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement multi-table association update in SQL update

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces how to achieve multi-table association update in SQL update. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

There are An and B tables, and their records are as follows:

Table A

C1 c2-1 a12 a23 a38 a8

Table B

C1 c3-1 b12 b13 b310 b10

A.c1 is equal to B.c1. Use a sql statement to update the value of A.c2 to B.c3-

Sentence one

UPDATE A SET A.c2 = B.c3from A, Bwhere A.c1=B.c1

Sentence two

UPDATE ASET A.c2 = B.c3from An inner join B on A.c1=B.c1

Note:

Update cannot be followed by multiple tables, but it follows the from clause.

On how to achieve multi-table association updates in SQL update to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report