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
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 ..
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.