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 Link to comment https://forums.phpfreaks.com/topic/27462-2-tables-into-1-new-table/ 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; Link to comment https://forums.phpfreaks.com/topic/27462-2-tables-into-1-new-table/#findComment-125584 Share on other sites More sharing options...
jimbobsquarepants Posted November 17, 2006 Author Share Posted November 17, 2006 Spot On !!! Link to comment https://forums.phpfreaks.com/topic/27462-2-tables-into-1-new-table/#findComment-126066 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 .. Link to comment https://forums.phpfreaks.com/topic/27462-2-tables-into-1-new-table/#findComment-132635 Share on other sites More sharing options...
fenway Posted December 3, 2006 Share Posted December 3, 2006 Reverse how? Link to comment https://forums.phpfreaks.com/topic/27462-2-tables-into-1-new-table/#findComment-134469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.