Mar 8, 2004 #1 miraclemaker Programmer Joined Oct 16, 2002 Messages 127 Location GB Hi there. Is there some kind of query that will allow me to move / export some rows from one table to another in the same database? Thanks
Hi there. Is there some kind of query that will allow me to move / export some rows from one table to another in the same database? Thanks
Mar 8, 2004 1 #2 r937 Technical User Joined Jun 30, 2002 Messages 8,847 Location CA yes first, copy the rows from table1 into table2 like this -- Code: insert into table2 ( foo2 , bar2 , qux2 ) select foo , bar , qux from table1 where pk1 in ( 1, 3, 5, 937 ) then delete them from table1 -- Code: delete from table1 where pk1 in ( 1, 3, 5, 937 ) rudy http://r937.com/ SQL Consulting Upvote 0 Downvote
yes first, copy the rows from table1 into table2 like this -- Code: insert into table2 ( foo2 , bar2 , qux2 ) select foo , bar , qux from table1 where pk1 in ( 1, 3, 5, 937 ) then delete them from table1 -- Code: delete from table1 where pk1 in ( 1, 3, 5, 937 ) rudy http://r937.com/ SQL Consulting
Mar 8, 2004 Thread starter #3 miraclemaker Programmer Joined Oct 16, 2002 Messages 127 Location GB Excellent, thanks. Upvote 0 Downvote