Copy to another table

[expired user #9295]'s profile image [expired user #9295] posted 8 years ago in Import/Export Permalink
I am new to this program and I need to get data from one database table "A" to another database table "B" which either tables (source and target) have different column names, example follows:

Database A Database B
Table Members Table Users
MKey UKey
FirstName First
LastName Last
DOB LastUpdate
City Date

As you can see, I ONLY need to copy the data from table "members" to table "users" and only certain columns from Members (FirstName -> First) and (LastName -> Last)

Is there a tutorial on how to do this? Instructions?

using latest version of HeidiSQL

Thanks
[expired user #9295]'s profile image [expired user #9295] posted 8 years ago Permalink
Seems that the text got messed up. Here is a screenshot of the example:

http://screencast.com/t/KtVOTKLxSd

ansgar's profile image ansgar posted 8 years ago Permalink
There is no GUI way of doing such a specific thing in HeidiSQL.

But MySQL supports a very effective version of an INSERT statement which does exactly what you want:
INSERT INTO B (name, lastedit, ...)
SELECT title, last_edit_time, ... FROM A WHERE whatever=123

Please login to leave a reply, or register at first.