我可以将某些内容复制到其他表并在同一个表中更新它吗?
喜欢:
INSERT INTO 'table_new' (name) values ("thomas")
同时:
UPDATE 'table_old' set ChangesWereMadeAt = (the date, where the changes were made)
我可以在其他表中放入一些内容,同时它也保留在旧表中并且只更新一列吗?
我使用 PHP/MySql
最佳答案
使用LAST_INSERT_ID();
INSERT INTO 'table_new' (name) values ("thomas");
$last_id_inserted = LAST_INSERT_ID();
UPDATE 'table_old' SET blah='$blah' WHERE id='$last_id_inserted';
关于php - Mysql/PHP 更新表 + 插入另一个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28472568/