I have 2 tables.
Table1:
Name Date Project Hrs
VKR 0727 X 8
VKR 0728 A 4
VKR 0728 B 4
VKR 0729 C 8
Table2:
Name Date Project Hrs
VKR 0728 123 8
VKR 0729 234 8
VKR 0730 345 8
I need to join these tables on Name and Date and the output I am expecting should look like below:
Name Date Table1.Project Table1.Hrs Table2.Project Table2.Hrs
VKR 0727 X 8
VKR 0728 A 4 123 8
VKR 0728 B 4
VKR 0729 C 8 234 8
VKR 0730 345 8
I have tried using FULL OUTER JOIN but that doesn't seem to work. This is my query
Select nvl(T1.Name,T2.Name), nvl(T1.Date,T2.Date), T1.Project, T1.Hrs,
T2.Project, T2.Hrs from Table1 T1
full outer join Table2 T2 on T1.Name = T2.Name
and T1.Date = T2.Date
The issue I face is, If I have 2 rows for the same Name and Date in Table1 and 1 row for the same key in Table2, I get 2 rows from Table2, something like below:
Name Date Table1.Project Table1.Hrs Table2.Project Table2.Hrs
VKR 0728 A 4 123 8
VKR 0728 B 4 123 8
which I do not want.
Any help is appreciated. Thanks in advance