Mysql Bulk Update

霸气de小男生 提交于 2019-11-30 09:26:32

Create a temp table (containing just the value1 and value2 values) and populate it in bulk (ie, you can potentially do this with a single insert statement). Then do an update using a join between your existing table and the temp table.

Something like

INSERT INTO SomeTempTable(id, some_id)
VALUES (1,2), (3,4), (5,6), .......


UPDATE A INNER JOIN SomeTempTable ON A.id = SomeTempTable.id SET A.some_id = SomeTempTable.some_id;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!