How do I combine two tables in MySQL keeping all columns? -


i have 2 tables different structures. want query mysql columns both tables in single query.

so example, if have person table , animal table, want query return:

person_name|person_age|animal_type|animal_name ______________________________________________ ryan       |31        |null        |null fred       |23        |null        |null null       |null      |cat         |whiskers null       |null      |dog         |wishbone 

i have basic knowledge of mysql , couldn't understand of material reading , googling, , didn't seem match want.

thanks!

you want union query concatenates 2 result sets

select person_name, person_age,        null animal_type, null animal_name   person  union  select null person_name, null person_age,        animal_type, animal_name   animal 

each select query shapes result set in similar way, , union puts them together.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -