Dokĉjo KINNE (kinnerc) wrote in mysql,
Dokĉjo KINNE
kinnerc
mysql

How to Merge Databases?

I have two tables (same DB format) that I'd like to merge.

One table has the format of several colums:

ID, AlphaCol, BetaCol, GammaCol

The other has different columns:

ID, Foo, Bar, Baz

The ID colum in both are what ties the separate tables together.

I started out the process with the following command:

create table combinedtable select * from firsttable;

This created combinedtable with the columns ID, AlphaCol, BetaCol, GammaCol. Everything's cool so far.

Then, I thought I could do a command like:

insert into combinedtable select secondtable.Foo, secondtable.Bar, secondtable.Baz from secondtable, combinedtable where combinedtable.ID = secondtable.ID;

When I try this, however, I consistently get the error:

Error 1136 (21S01): Column doesn't match value count at row 1.

So, I'm missing something basic, but I didn't think this would be that difficult. What am I doing wrong?
  • Post a new comment

    Error

    default userpic
  • 2 comments