SirChick Posted August 31, 2007 Share Posted August 31, 2007 Is there way to move a record from one table to another ... or will i just have to get row put each field data in a variable and then insert to a new row and delete old row? Kinda hoping theres a simple move feature to make life slightly quicker ? Link to comment https://forums.phpfreaks.com/topic/67469-moving-a-record/ Share on other sites More sharing options...
lemmin Posted August 31, 2007 Share Posted August 31, 2007 You can just use a sub-query in place of the data. It would be something like: "INSERT INTO table2 (field1, field2, field3) VALUES ((SELECT field1 FROM table1 WHERE something = something), (SELECT field2 FROM table1 WHERE something = something), (SELECT field3 FROM table1 WHERE something = something))" Link to comment https://forums.phpfreaks.com/topic/67469-moving-a-record/#findComment-338744 Share on other sites More sharing options...
roopurt18 Posted August 31, 2007 Share Posted August 31, 2007 That's pretty inefficient if all of the records are coming from the same row in the source table. INSERT INTO tblDest (dest1, dest2, dest3) SELECT src1, src2, src3 FROM tblSrc WHERE conditions Link to comment https://forums.phpfreaks.com/topic/67469-moving-a-record/#findComment-338747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.