Thanks in advance! this is little long question but hopefully it is clear and concise.
I have two different query bringing two data sets.
both datasets are bringing data in same grain for similar area.
first data set has multiple snapshots per month of a season , so it have three different metrics value for each season for same grain for a season.
Dataset 1 ( country , season , month , metric is column names ) (1. A , autumn, 9/1, 1 is the record for column)
country season month metric
- A, autumn , 9/1 , 1
- A, autumn , 10/1 , 2
- A, autumn , 11/1 , 3
where as the second data set has one snapshots (just one month out of season) for a season, so it will have just one snapshot per season.
Dataset 2
country season month metric
- A , autumn , 9/1 , 4
my current approach of full outer join is giving me the following output
country season month metric1 metric2
A, autumn, 9/1, 1, 4
A, autumn, 10/1, 2,
A, autumn , 11/1, 3 ,
**Notice the metric2 for 10/1 and 11/1 are blank or zero if use nvl but what we need is to populate same value 4 for these two months as well how can we achieve this
or FINAL OUTPUT should look something like this
country season month metric1 metric2
A, autumn, 9/1, 1, 4
A, autumn, 10/1, 2, 4
A, autumn , 11/1, 3 , 4
Change the join condition.
Instead of just using
Use the conditions in join as -
Now I don’t know about the data type of month. I have put the logic but to actually compare you may need to do type casting as required for proper comparison using >=