MYSQL は、あるテーブルから別のテーブルにデータを更新します

MYSQL は、あるテーブルから別のテーブルにデータを更新します

方法 1:

update update table set field = (更新 table.id = 元の table.id の元のテーブルから元のデータを選択)

例えば:

update a set code = (select b.code from b where a.id = b.id),
name = (select b.name from b where a.id = b.id) 

方法 2:

update 更新テーブル、元のテーブルセット update table data = 元のテーブルデータ、update table.id = 元の table.id

例:update a,b set a.code = b.code ,a.name = b.name where a.id = b.id;

おすすめ

転載: blog.csdn.net/qq_42547733/article/details/133795548