In SQL, how does one use columns in one table to update columns in another table?

Source: Internet
Author: User
I have two tables, all of which are mobile phone numbers. Table A contains Table B. The col001 columns of both tables are mobile phone numbers,
Table B of column col002 is a number and table A is 0. To compare the two tables, as long as the mobile phone number of Table B in Table A is used,
Then, the number corresponding to col002 in Table B is automatically updated to col002 in table A. How can we use update to implement this?

 

 

Update aset A. col002 = B. col002from bwhere A. col001 in (select col001 from B) or update aset A. col002 = B. col002from bwhere A. col001 = B. col001

 

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.