The following describes how to insert a new table into the MYSQL query results of two tables. This method is for your reference. If you have encountered any problems in MYSQL query result processing, take a look.
Table
+ ------------------- +
| Id | user | info |
| 1 | u1 | 991 |
| 3 | u3 | 113 |
+ ------------------- +
Table B
+ ------------------- +
| Id | user | pw | pw2 |
| 1 | u1 | p1 | p12 |
| 2 | u2 | p2 | p22 |
| 3 | u3 | p3 | p32 |
+ ------------------- +
Can I create A new table using A statement and convert it into the following results? excluding the IDs that are not in Table B but not in Table A and merging the data with the same ID? Of course.
- +-------------------------+
- |id |user |pw1 |pw2 |info |
- |1 |u1 |p1 |p12 |991 |
- |3 |u3 |p3 |p33 |113 |
- +-------------------------+
Implementation statement for inserting the MYSQL query results of two tables into the new table
- view sourceprint?1 create table jieguo2 SELECT t1.id, t1.user,t1.pwd,t1.pwd2,t2.user2,t2.info FROM t1 INNER JOIN t2 ON t1.id = t2.id
The above describes how to insert the MYSQL query results of the two tables into the new table.
Command for viewing the Mysql table structure
About date format conversion functions in MySQL Query
Implementation of querying the first letter of Chinese characters and Pinyin in MySQL
Optimization instance for MySQL random Query
MySQL query cache Variables