How to Merge Databases?

    Date: 07/06/09 (MySQL Communtiy)    Keywords: no keywords

    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?

    Source: https://mysql.livejournal.com/136144.html

« Efficient full-text searchs... || Find datetimes with time of... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home