move rows from one table into another

Let’s say you want to move rows from one table into another table within the same db (for instance, you implement an ‘undo’-like operation), you can do it pretty easily with a single sql statement:

INSERT INTO table2 SELECT * FROM table1 where row = row id

Of course, feel free to adapt it to your own requirements.

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...