【发布时间】:2016-04-29 17:29:18
【问题描述】:
我愿意
UPDATE table SET column = 1 where column = 0;
INSERT (rows i just updated) INTO history_table;
我能否以某种方式存储来自选择查询的 id,然后使用这些 UPDATE 并随后将匹配这些 id 的行插入到历史表中?
【问题讨论】:
-
在更改它们之前,您需要将 column = 0 的行保存到 history_table 中。如果历史表包含其他行,您可能需要使用 pre_history_table,将它们设置为零,然后插入 history_table。
标签: mysql