MYSQL, Copy selected fields from one table to another

后端 未结 8 1757
情深已故
情深已故 2020-12-23 09:58

In MySQL, How do I copy a FIELD with all RECORDS from TABLE1 to TABLE2 which corresponds to a primary key ie: EMPLOYEE no.?

8条回答
  •  暖寄归人
    2020-12-23 10:45

    The query for copy data from one table to another is:

    Insert into table2 (field1, field2)  select field1, field2 from table1
    


    If you want to copy only selected values, then use where clause in query

    Insert into table2 (field1, field2)  select field1, field2 from table1 where field1=condition
    


提交回复
热议问题