Copy Row From One Table To Another

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
djwk
Forum Commoner
Posts: 56
Joined: Tue Mar 07, 2006 2:14 pm

Copy Row From One Table To Another

Post by djwk »

Hi there,

In effect I would like to "cut and paste" a row from one table to another in my database, both tables have the same structure. I know I could do it by reading all the variables and inserting them into the new table but I'm sure there must be a simpler, more efficient way of acheiving this.

Any help would be greatly appreciated.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Copy Row From One Table To Another

Post by Jade »

You can do a insert select statement. Basically you insert from one table via the selection of another table's values: http://dev.mysql.com/doc/refman/5.0/en/ ... elect.html
Post Reply