jasonsalas
IS-IT--Management
I've got two tables, TABLE1 and TABLE2. TABLE2 has the exact same columns and data types as TABLE1, with an additional INT column as a foreign key to TABLE1's primary key.
I'm trying to create a homegrown rollback operation wherein when a record is updated in a webpage, the contents of TABLE1 are copied as is into TABLE2, and then TABLE1 will be UPDATE'd.
How can I copy the contents of a record into another table? I was trying the following, but it didn't work:
INSERT INTO TABLE2 (COL1,COL2,COL3) VALUES SELECT COL1,COL2,COL3 FROM TABLE1 WHERE id = '12345'
I'm trying to create a homegrown rollback operation wherein when a record is updated in a webpage, the contents of TABLE1 are copied as is into TABLE2, and then TABLE1 will be UPDATE'd.
How can I copy the contents of a record into another table? I was trying the following, but it didn't work:
INSERT INTO TABLE2 (COL1,COL2,COL3) VALUES SELECT COL1,COL2,COL3 FROM TABLE1 WHERE id = '12345'