Re: Copy data from one mysql table to another?

From: Date: Wed, 28 Mar 2001 21:07:21 +0000
Subject: Re: Copy data from one mysql table to another?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7946@lists.php.net to get a copy of this message
In article <20010328205335.55424.qmail@web13308.mail.yahoo.com>, bstone98@yahoo.com (Bob Stone) wrote: > I cannot find any documentation on how to copy the > data from one mysql table to another, i.e. table1, > columnx to table2, columnx. See the mysql documentation of the "insert into" syntax for how to use a trailing "select" statement to get the values to be inserted. In a single statement you can select the data from one table and insert it into another. Example: "insert into table2 (p_key,data) select p_key,data from table1 where p_key >100 and data !='garbage'" (This also works for "replace into" and "create table" statements, BTW. Nifty, eh? <g>) -- CC

« previous php.db (#7946) next »