I have a written a query which is not producing the desired output.Please help me in getting the output.
select b.id,emp,city,gender,age from tablea a full outer join tableb b on a.id=b.id
Tablea
------
id emp city
------------ -------------------- ----------
12345 test1 NY
12346 test2 VA
12347 test3 MD
12348 test4 GA
12350 test5 LA
Tableb
------
id gender age
------------ ------ ----
12346 M 20
12347 M 25
12348 F 30
12349 M 56
12364 F 58
I need the below output.
id emp city gender age
------------ -------------------- ---------- ------ ----
12345 test1 NY NULL NULL
12346 test2 VA M 20
12347 test3 MD M 25
12348 test4 GA F 30
12350 test5 LA NULL NULL
12364 NULL NULL F 58
12349 NULL NULL M 56
select b.id,emp,city,gender,age from tablea a full outer join tableb b on a.id=b.id
Tablea
------
id emp city
------------ -------------------- ----------
12345 test1 NY
12346 test2 VA
12347 test3 MD
12348 test4 GA
12350 test5 LA
Tableb
------
id gender age
------------ ------ ----
12346 M 20
12347 M 25
12348 F 30
12349 M 56
12364 F 58
I need the below output.
id emp city gender age
------------ -------------------- ---------- ------ ----
12345 test1 NY NULL NULL
12346 test2 VA M 20
12347 test3 MD M 25
12348 test4 GA F 30
12350 test5 LA NULL NULL
12364 NULL NULL F 58
12349 NULL NULL M 56