dani33l_87 Posted February 7, 2013 Share Posted February 7, 2013 Hi, How can I copy the value from a column (table nw_items) to other table (nw_products). or even better, into a column (in nw_products) that already exists and has all values set to 0 ? I tried this INSERT INTO nw_products (ID_PLAYER) SELECT nw_items.ID_OWNER FROM nw_items; and got this error :#1062 - Duplicate entry '0-0' for key 'PRIMARY' Quote Link to comment Share on other sites More sharing options...
Barand Posted February 7, 2013 Share Posted February 7, 2013 Give us a clue. What is the structure of said tables and how are they related? Quote Link to comment Share on other sites More sharing options...
alena1347 Posted February 7, 2013 Share Posted February 7, 2013 (edited) suppose you have two tables table1 and columnname1 as column and table2 with columnname2 as column then the query would look like UPDATE table1,table2 SET table1.columnname1=table2.columnname1 where table2.columnname1=something; the error is for inserting duplicate values in the column with primary key check for that Edited February 7, 2013 by alena1347 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.