I have data in 2 tables and I need to split/and merge the data from table1 based on the data in table2 by looking for any overlaps in both. Can anybody provide tips to get this done in oracle?
Table1:
Col1 Col2 Dt1 Dt2 Quantity
I1 L1 D2 D90 19
I1 L1 D6 D18 6
Table2
Col1 Col2 Dt1 Dt2 Quantity
I1 L1 D10 D25 10
I1 L1 D12 D42 20
Now split the data from table1 referring to table2 and output should be like below. Any data in tab1 that does not overlap with data from tab2 should be discarded.
Output:
Step1:
Col1 Col2 Dt1 Dt2 Price
I1 L1 D10 D42 19
I1 L1 D10 D18 6
Final o/p:
Col1 Col2 Dt1 Dt2 Price
I1 L1 D10 D18 25
I1 L1 D18 D42 6