mysql - Concatenating two tables with same column number and name -



mysql - Concatenating two tables with same column number and name -

i have 2 tables:

table_a

head1 head2 foo case1 bar case2

and table_b

head1 head2 hux case1 pix case2 ilf case1

what want create table:

head1 head2 foo case1 bar case2 hux case1 pix case2 ilf case3

namely combine them, without removing redundancy.

what's right command it? tried didn't give the desired result.

create table table_ab(head1 text, head2 text) (select * table_a) union (select * table_b)

you can omit parenthesis around union parts. also, create table ... select, don't have specify column definitons.

create table table3 select * table1 union select * table2

example @ sql fiddle.

mysql sql

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -