Jump to content

2 Tables Into 1 New Table ....


jimbobsquarepants

Recommended Posts

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_id
products_model

Table B:
products_id
products_code

Table C:
products_id
old_code
new_code
old_model
new_model

So 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 lol

Cheers ...  ;D
Link to comment
https://forums.phpfreaks.com/topic/27462-2-tables-into-1-new-table/
Share on other sites

  • 2 weeks later...
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 ..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.