wood burning stoves 2.0*
The moose likes JDBC and the fly likes Copy data from one table to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Copy data from one table to another" Watch "Copy data from one table to another" New topic
Author

Copy data from one table to another

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Hello, I want to copy some data from one table (orderpaymentno) to another table (order) in mySQL. The two tables are not identical.

I also have to predefine some data in the new table. This is the SQL query I have tried out but it doesn�t work.

Can anyone help me correcting the SQL query ?
[ February 19, 2007: Message edited by: Jeppe Fjord ]
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

In the INSERT INTO clause, you can only put column names.
If the values 2, 2, 'Afdeling (I understand that!)' and 2 need to be fixed values, then you must put their column name in the INSERT INTO clause, and their value in the SELECT clause:



Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Thank you :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Copy data from one table to another
 
Similar Threads
Complex HQL query conversion (from SQL)
MySQL update issue
Copy field in the same table
Ajax call for window.location.href
Transposing rows to columns