garethdn
garethdn

Reputation: 12351

Copy MySQL columns from one table to another

I'd like to copy a number of rows from one table to another within phpmyadmin. The table i'm copying from is the profile table. The table user i'm copying to already exists but the columns do not. I'm attempting the following command in the SQL tab of phpmyadmin.

INSERT INTO user 
   (profileImage, 
   skypeName, 
   facebookProfile, 
   twitterProfile, 
   reputation, 
   genderPreference, 
   agePreference, 
   fluentLanguage, 
   desiredLanguage) 

(SELECT profileImage, skypeName, facebookProfile, twitterProfile, reputation, genderPreference, agePreference, fluentLanguage, desiredLanguage FROM profile)

For some reason this isn't working out for me. I'm getting an error:

#1054 - Unknown column 'profileImage' in 'field list'

profileImage exists in the profile table, i.e. it is the name of one of my fields

Does anyone know what the problem might be?

Upvotes: 0

Views: 10264

Answers (2)

user1450789
user1450789

Reputation:

You can copy the structure of the table 1 to table 2 in phpmyadmin and can then run query to copy certain rows from table 1 to table 2.

Upvotes: 0

Grim...
Grim...

Reputation: 16953

If the error is #1054 - Unknown column 'proileImage' in 'field list' then, simply, that column doesn't exist in either (or both) your profile or your user table.

Just run the select part of the query, ie. SELECT profileImage, skypeName, facebookProfile, twitterProfile, reputation, genderPreference, agePreference, fluentLanguage, desiredLanguage FROM profile

Does that work?

If so, are you sure profileImage exists in the user table?

Upvotes: 1

Related Questions