MySQL Forums
Forum List  »  Newbie

Add new colums to one existing table with copying from another existing table
Posted by: Nico Kamp
Date: October 15, 2016 07:57AM

Hello,

I have for example two table's
table_1:
Column 1: Temc
Column 2: name_a
Column 3: name_b

Table_2:
Column 1: Temc
Column 2: name_x
Column 3: name_y

In the end I will drop table_1, But before I will do this, I will first:

Step 1:

Move column 2 and column 3 (and more) of table_1 to table_2 so that they are added there. Off course I can do it manually but I think that this also could be done by an sql script.

Step 2:
Move also the content for these columns from table_1 to table_2, with the where clause table_2.temc = table_1.temc

Step 3:
Drop table_1.

Step 2 and 3 are not really the problem but step 1. I can't find it by googling. All topics are about moving the content.

If it all can be done in one step/script is also fine.

I hope that someone can help me out.

Thanks in advance.

Nico

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.