How to fill a column with data from the column of 2 other tables?

0

I have the following tables:

TABLE A:

ID NOMBRE

1   A 

2   B 

3   C

and TABLE B :

ID  NOMBRE

1   D 

2   E 

and I want to insert the data from the "name" columns of both tables in the "name" column of a third table ( TABLE C ).

and I have something like this:

TABLE C

ID  NOMBRE

1   A 

2   B 

3   C

4   D

5   E

I have to clarify that the 3 tables have the same structure. Thanks in advance for the help.

    
asked by dev01 08.05.2018 в 22:39
source

1 answer

1

Well, if you're just looking for that then an option could be to first pass the values from table A to table C with the following:

INSERT INTO TABLA_C(nombre) SELECT nombre FROM TABLA_A

And then pass the values from table B to table C

INSERT INTO TABLA_C(nombre) SELECT nombre FROM TABLA_B

The other option is to join UNION from tables A and B.

    
answered by 08.05.2018 в 22:46