List:General Discussion« Previous MessageNext Message »
From:jeffrey_n_Dyke Date:January 12 2004 7:52pm
Subject:Re: How to move data between tables in a database?
View as plain text  
                                                                                          
                                             
                      "Syed Ali"                                                          
                                             
                      <syed@stripped        To:       <mysql@stripped> 
                                                      
                      m>                       cc:                                     
                                                
                                               Subject:  How to move data between tables
in a database?                                 
                      01/12/2004 12:54                                                    
                                             
                      PM                                                                  
                                             
                                                                                          
                                             
                                                                                          
                                             








Hello,

I would like to move data between tables in mysql within the same
database, I am not sure what the best way to go about it is.
I do not need to move all the data in the tables, just the output of
some select statements.

>> You could use INSERT INTO TABLE2(SELECT * FROM TABLE 1)
>>  HTH
>>  Jeff
>> From Manual on page http://www.mysql.com/doc/en/INSERT.html

INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
        [INTO] tbl_name [(col_name,...)]
        SELECT ...



I am using Perl DBI and MySql 4.0.15-standard on RedHat 8.0.
I guess I can run a select statement and copy all the data into a Perl
array, then copy the data into another MySql table and then delete from
the original table. But this seems like "too much" work, perhaps there
is an easier way?

Thank you...

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1





Thread
How to move data between tables in a database?Syed Ali12 Jan
  • Re: How to move data between tables in a database?harm12 Jan
Re: How to move data between tables in a database?jeffrey_n_Dyke12 Jan