Reputation: 61
i've question about insert query mysql
i want to insert from a table data from another table. here's my table :
table 1
id , name
23 , test_name
and
table 2
id, code_name , name
23 , 23 , test_name
i want insert table 2 with kode_name same value with id from table 1 i don't know how to insert with code_name same value id from table 1
how to do this?
Upvotes: 1
Views: 114
Reputation: 1749
INSERT INTO Table2(ID, Code_Name, Name) SELECT ID, ID, Name FROM Table1
Upvotes: 3