mysql - Join two tables by row -
have 2 tables same column need merge 2 table below
table1 id name 1 test1 4 test7 5 test9 6 test3 table2 id name 2 test2 3 test5 6 test3 result id name 1 test1 2 test2 3 test5 4 test7 5 test9 6 test3
so need join/merge 2 tables id , can see id 6 present in both table need override table 2 value , give above result. kindly me solve issue.
thank you.
select id,name table1 union select id,name table2 ;
other way
select * ( select id,name table1 union select id,name table2)temp order temp.id ;
this arrange records id wise
union eliminate duplicate record , in case it's id 6
Comments
Post a Comment