Sql-update Statement Multi-table cascading update

Source: Internet
Author: User
Tags one table

When the data table is updated, there may be a situation where the updated content is derived from the other tables, at which point the from is added to the UPDATE statement, and the following is an example:

Update a set a.name=b.name,a.value=b.value from table1 a,table2 b where b.id= ' Id2 ' and a.id=b.id

Then there is a problem, if you update two tables at the same time, can be implemented?

For example, the following statement:

Update set a.name=b.name,a.value=b.value,c.value=fromwhere b.id = ' Id2 '  and a.ID= and a.id=c.id

The result of my attempt is not to update the two tables at the same time, only one table of the table is updated (i.e. the above statement should be split into two pieces, executed separately).

Sql-update Statement Multi-table cascading update

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.