Re: select records to send to another table in another database

2008-04-10 Thread Christoph Boget
 I have a slew of records that went to the wrong database.  The tables
  have the same names and now I want to copy those records over to the
  correct database.  Is there such a mechanism using the cli mysql
  application in Linux?

If the tables have the same schema, you should be able to just do a
mysql dump and pipe that back into itself.  Something along the lines
of:

mysqldump old_table | mysql new_table

But that will only work if the tables have the same structure.  If
they don't, you can work with variations of the above.

thnx,
Chris

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: select records to send to another table in another database

2008-04-10 Thread Paul DuBois

At 12:21 PM -0400 4/10/08, Larry Brown wrote:

I have a slew of records that went to the wrong database.  The tables
have the same names and now I want to copy those records over to the
correct database.  Is there such a mechanism using the cli mysql
application in Linux?


For each corresponding table:

INSERT INTO db1.mytable SELECT * FROM db2.mytable;

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: select records to send to another table in another database

2008-04-10 Thread Jerry Schwartz
 I have a slew of records that went to the wrong database.  The tables
  have the same names and now I want to copy those records over to the
  correct database.  Is there such a mechanism using the cli mysql
  application in Linux?

If the tables have the same schema, you should be able to just do a
mysql dump and pipe that back into itself.  Something along the lines
of:

mysqldump old_table | mysql new_table

But that will only work if the tables have the same structure.  If
they don't, you can work with variations of the above.

[JS] I think he wants to bring over only certain records. In that case he
can use INSERT INTO ... SELECT ...,
Where the INSERT INTO references the table in one database and the SELECT
references the table in the other database.

thnx,
Chris

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: select records to send to another table in another database

2008-04-10 Thread Christoph Boget
  I have a slew of records that went to the wrong database.  The tables
  have the same names and now I want to copy those records over to the
  correct database.  Is there such a mechanism using the cli mysql
  application in Linux?
  For each corresponding table:
  INSERT INTO db1.mytable SELECT * FROM db2.mytable;

And you can do that using the cli mysql app?

thnx,
Chris

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: select records to send to another table in another database

2008-04-10 Thread Jerry Schwartz
Yes

Regards,

Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com

-Original Message-
From: Christoph Boget [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 10, 2008 1:09 PM
To: Paul DuBois
Cc: Larry Brown; Mysql
Subject: Re: select records to send to another table in another database

  I have a slew of records that went to the wrong database.  The tables
  have the same names and now I want to copy those records over to the
  correct database.  Is there such a mechanism using the cli mysql
  application in Linux?
  For each corresponding table:
  INSERT INTO db1.mytable SELECT * FROM db2.mytable;

And you can do that using the cli mysql app?

thnx,
Chris

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: select records to send to another table in another database

2008-04-10 Thread Paul DuBois

At 1:09 PM -0400 4/10/08, Christoph Boget wrote:

   I have a slew of records that went to the wrong database.  The tables

  have the same names and now I want to copy those records over to the
  correct database.  Is there such a mechanism using the cli mysql
  application in Linux?
  For each corresponding table:
  INSERT INTO db1.mytable SELECT * FROM db2.mytable;


And you can do that using the cli mysql app?


Yes.  You can do this in any interface that enables you to
issue SQL statements.

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: select records to send to another table in another database

2008-04-10 Thread Larry Brown


On Thu, 2008-04-10 at 11:43 -0500, Paul DuBois wrote:

 
 For each corresponding table:
 
 INSERT INTO db1.mytable SELECT * FROM db2.mytable;
 
 -- 
 Paul DuBois, MySQL Documentation Team
 Madison, Wisconsin, USA
 MySQL AB, www.mysql.com
 

That is exactly what I was looking for.  Thank you all very much.  

Larry

-- 
Larry Brown [EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]