Reputation: 10838
I am trying to copy from 1 table to another table on different database.
The SQL query dont seem to work:
INSERT INTO db1.table
SELECT T.number, T.dob, T.house_number FROM `db2.table2` as T;
I am getting an error saying:
ERROR 1146 (42S02): Table 'db2.table2' doesn't exist
Upvotes: 1
Views: 207
Reputation: 235
Could you try something like this:
select * into dbo.test2 from dbo.test1
Upvotes: 0
Reputation: 86774
If you insist on quoting the table name (not needed), it should be
FROM `db2`.`table2`
Upvotes: 4
Reputation: 271
CREATE TABLE recipes_new LIKE production.recipes;
INSERT recipes_new SELECT * FROM production.recipes;
Check out this link: http://www.tech-recipes.com/rx/1487/copy-an-existing-mysql-table-to-a-new-table/
Upvotes: -1