jimbobsquarepants Posted November 16, 2006 Share Posted November 16, 2006 Hello All,Im sure this is gonna be an easy question to solve :-[ We are changeing product codes on about 24,000 products :'( so what i want 2 do is copy data from a couple of tables and put them in 1.I have 3 tables A, B & C.Table A:products_idproducts_modelTable B:products_idproducts_codeTable C:products_idold_codenew_codeold_modelnew_modelSo what im trying do 2 (probs not the be way) is copy the products_id from tables A & B into table C as they are both the same. then copy products_model from table A into table C as old_code. then copy products_code from table B into table C as old_model. then i have a excel sheet with the old_code, new_code & new_model that i will need to put in table C ... so they match old_code ... if you kinda get what i mean lolCheers ... ;D Quote Link to comment Share on other sites More sharing options...
exploo Posted November 16, 2006 Share Posted November 16, 2006 I think this will copy A and B into CINSERT INTO C (products_id, old_code, old_model) SELECT A.products_id, A.products_model, B.products_code FROM A,B WHERE A.products_id=B.products_id; Quote Link to comment Share on other sites More sharing options...
jimbobsquarepants Posted November 17, 2006 Author Share Posted November 17, 2006 Spot On !!! Quote Link to comment Share on other sites More sharing options...
jimbobsquarepants Posted November 30, 2006 Author Share Posted November 30, 2006 Just a quick question guys .....How would i go back the other way .. this is the one i want to reverse.[quote author=exploo link=topic=115200.msg468990#msg468990 date=1163691706]INSERT INTO C (products_id, old_code, old_model) SELECT A.products_id, A.products_model, B.products_code FROM A,B WHERE A.products_id=B.products_id;[/quote]Cheers .. Quote Link to comment Share on other sites More sharing options...
fenway Posted December 3, 2006 Share Posted December 3, 2006 Reverse how? 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.