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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -