Update a LEFT join C on a.id = C.id set a.body = C.C1 where a.id=c.id;
Update Zcat as Z left join zcat_bak_1212 as ZB on z.zcatid = Zb.zcatid set z.zcatname = zb.zcatname where Z.zcatname is Nu ll
I used the following
Update Z_vnetid__money a LEFT join Tab_feeaccount b on a.c_vnetid = B.c_accountcode set a.i_id = b.i_id where A.c_vnetid = B.c_accountcode;
1. The table structure is exactly the same
Insert INTO Table 1
SELECT * FROM Table 2
2. The table structure is different (in this case you have to specify the column name)
Insert INTO table 1 (column name 1, column name 2, column name 3)
Select column 1, column 2, column 3 from table 2
3. Take partial values from another table only
Insert INTO table 1 (column name 1, column name 2, column name 3) VALUES (column 1, column 2, (select column 3 from table 2));
MySQL update the field in one table equals the value of a field in another