If you could please help with this Oracle (11gR2) query..
I have two tables T1: (about 1000 records)
F1 varchar2
F2 number
F3 number
F4 number
F5 date
And T2: (about 600 records)
F1 varchar2
F2 number
F3 number
F4 number
F5 date
All records in T2 is in T1.
I need to update T1 table's F5 field with the value of T1 table's F5 value when there is a match of T1.F1=T2.F1, T1.F2=T2.F2, T1.F3=T2.F3, T1.F4=T2.F4.
So the Output will return 1000 records (all T1 entries and possibly 600 rows updated with F5 values.)
Now problem is I call it a match if F1 is null in both tables and rest F2, F3, F4 values match.
If I write select T1.F1, T1.F2, T1.F3, T1.F4, T2.F5
from T1, T2
where T1.F1=T2.F1
and T1.F2=T2.F2
and T1.F3=T2.F3
and T1.F4=T2.F4
I do not get the correct output..
- will a WHERE clause on both T1F1 and T2.F1 <> NULL work?