Database-question about updating fields in multi-table queries using native mysql statements

Source: Internet
Author: User
Example: table a user_idschool_id12332201323462425234423445224722017 ...... table B user_idterm21_123161231622247212331 ...... the above two tables: obtain its user_id based on school_id22017 in Table a, then obtain the term in Table B based on this user_id, change term1 to term2, and change term2 to term1 mysql database

Example:
Table
User_id school_id
1233 22013
2346 22017
2344 23445
2247 22017
......

Table B
User_id term
2346 1
2346 1
2346 2
2247 2
1233 1
......

The above two tables:
Obtain its user_id according to school_id = 22017 in Table a, and then obtain the term in Table B according to this user_id.

Change the term = 1 to term = 2, and change the term = 2 to term = 1.

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.