How to insert the data of one table into the other

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seshu
    New Member
    • Nov 2006
    • 156

    How to insert the data of one table into the other

    Hi everybody
    This is seshu here i am struck with one point i want to get the data of one table ie table1 ofcourse not the whole table only two out of five columns and i want to insert those two columns in an empty new table which is having five columns in which two of them are similar to the columns i have selected from table1
    please help me out
    regards
    seshu
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    As always, the answer is in the MySQL manual, chapter INSERT Syntax

    For your problem something like
    Code:
    INSERT INTO TargetTable (col1, col2, col3)
    SELECT col1,col2, col3
    FROM SourceTable
    Ronald :cool:

    Comment

    Working...