I'm having some problem creating a SELECT query (hopefully, with one or two SQL statement only) that would output the contents of two tables. Example, given the table1 and table2 as follows:
table1
------------------------
ID data1 data2
------------------------
1 100 aaa
2 200 bbb
3 300 ccc
4 400 ddd
5 500 eee
------------------------
table2
------------------------
ID info1 info2
------------------------
1 11 xyz
2 22 abc
3 33 123
7 77 456
8 88 opq
------------------------
the output of the query from table1 and table2 should be as follows:
---------------------------------------------------
ID data1 data2 info1 info2
---------------------------------------------------
1 100 aaa 11 xyz
2 200 bbb 22 abc
3 300 ccc 33 123
4 400 ddd
5 500 eee
7 77 456
8 88 opq
---------------------------------------------------
as you could see, there are some records present in both tables and some don't, but I need all the data to be returned by the SELECT query. How will I do this?
Thanks in advance.
table1
------------------------
ID data1 data2
------------------------
1 100 aaa
2 200 bbb
3 300 ccc
4 400 ddd
5 500 eee
------------------------
table2
------------------------
ID info1 info2
------------------------
1 11 xyz
2 22 abc
3 33 123
7 77 456
8 88 opq
------------------------
the output of the query from table1 and table2 should be as follows:
---------------------------------------------------
ID data1 data2 info1 info2
---------------------------------------------------
1 100 aaa 11 xyz
2 200 bbb 22 abc
3 300 ccc 33 123
4 400 ddd
5 500 eee
7 77 456
8 88 opq
---------------------------------------------------
as you could see, there are some records present in both tables and some don't, but I need all the data to be returned by the SELECT query. How will I do this?
Thanks in advance.