CodeIgniter Forums
Moving 1 database row to another Table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Moving 1 database row to another Table (/showthread.php?tid=26695)



Moving 1 database row to another Table - El Forum - 01-20-2010

[eluser]Fielder[/eluser]
What's the simplest way to move an entire table row into another table? Perhaps there's a mySQL command?
Or will I have to query the current table to gather all the fields, insert them into the other table, then go back in the first table and delete that row?


Moving 1 database row to another Table - El Forum - 01-20-2010

[eluser]JHackamack[/eluser]
There is a MySQL command:

Code:
INSERT INTO smf_members (ID_MEMBER, memberName, emailAddress, passwd, dateRegistered, lastLogin ) SELECT id, name, email, password, creationtime, lastClickTime FROM classifieds_classifiedsuser WHERE COL1=COL1

Then you would do a separate delete command using your where clauses.