MySQL how to update fields from one table to another table

Business: update the fields of one table to another table;

I encountered a problem today. I was confused for a long time. In my memory, the first way of writing is correct, but in mysql, it is not right to try for a long time. writing;

The first way to write:

UPDATE t
SET t.spu = b.spu
FROM
table1 t,
table2 b
WHERE

t.vin = b.vin;

After tossing for a long time to find the information, I saw the following writing method, which can be executed normally;

Correct spelling:

UPDATE  table1 t, table2 b
SET t.spu = b.spu
WHERE

t.vin = b.vin;





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324576977&siteId=291194637