Mysql Query to copy columns between tables

Posted on 2014-08-12
Last Modified: 2014-08-12
I need to know how to copy the field data in a column from a populated mysql table, to an unpopulated mysql table.

Table1 - populated with rows
Columns - products_id, column_2, column_3 ...

Table2 - an empty table
Columns - products_id, column_A, column_B ...

I would like to mirror the Table1.product_id column over to Table2.product_id column

Is there a mysql query that would allow this to happen?
Question by:FourMat
    LVL 34

    Accepted Solution

    Try this (untested):
    INSERT INTO table2 (products_id) 
    SELECT products_id FROM table1

    Open in new window

    It more or less should work like this:


    Author Closing Comment

    Well, that was incredibly simple and I feel like an idiot for making it more complicated than it needed to be.  Thanks for the help!
    LVL 34

    Expert Comment

    by:Dan Craciun
    Glad I could help!

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now