George Garchagudashvili George Garchagudashvili - 1 year ago 120
SQL Question

Column count doesn't match value count

I have a applications table with many columns 50 or more, also I've a archive table for this applications.

Now I want to restore from archive table to main table, but their column count does not match each other, so running the query:

SELECT * FROM apps_archive
WHERE client_id = 1234

gives me an error:

Error Code: 1136 - Column count doesn't match value count at row 1

I've tried to use
statement but it only works when unique key may be problem.

Things that can help me, is to run this query anyway only on matching columns, or to make archive table match the main table structure.


Answer Source

Since the column count doesn't match, that means they two tables don't have the same table schema. If your apps table happens to have a lesser number of columns, then do a projection on the result from the apps_archive table. Otherwise, you can use a data integration tool like Talend Open Studios for data integration to do the migrate your data.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download