MySql Tutorial: There are two tables for updating data between two tables. The structure is as follows:
A (id, sex, email, public)
B (id, depart, salary)
As demand changes, a public field must be added to B, and the value of the public field must be the same as that in the record with the same id in Table.
It is easy to add a field, and you just need to directly alter it. However, if you haven't done any data update between tables before, you just need to google it. it turns out that many people write this in this way:
UPDATE B SET public =. public FROM a WHERE B. id =. id, but it is difficult to live and live in Mysql. it always prompts that there is an error. later, I checked the information and found that mysql does not support the from clause in update, many people on the Internet may write data for sqlserver or other databases. Rewrite the SQL statement as follows:
UPDATE B, a SET B. public = a. public WHERE B. id = a. id to learn something, recorded here.