MySQL and MsSQL multi-Table update

Source: Internet
Author: User

MySQL and MsSQL multi-Table update assume that we have two data tables, one of which stores Product data for the Product table, among them, there are product quota Price and a quota of the company's quota for the CompanyId;
Another example table is the Company table, which stores the basic information of the Company, including the region Region region Area, now, we want to bring down all the products in our products, such as those in the South region, by 10% in Mysql.

UPDATE product p inner join Company c ON p. companyId = c. companyIdSET p. price = p. price * 0.9 WHERE c. area = 'south' in SQL Server, we can UPDATE [p] SET [price] = [price] * 0.9 FROM [Product] AS [p] INNER JOIN [dbo ]. [Company] AS [c] ON [p]. companyId = [c]. companyIdWHERE [c]. [Area] = 'south'

 


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.