Hi All,
I have a requirement to load data into target table, before load data to target table for any product giving new startdate with out expiring old one, those records we need to identify by comparing stage and target table.
Stage table:
Product |
Startdate |
Enddate |
P1 |
03-01-2020 |
03-10-2020 |
P1 |
03-11-2020 |
12/31/2020 |
|
|
|
P3 |
07-30-2020 |
12/31/9999 |
P4 |
08-15-2020 |
12/31/9999 |
Target table(Initial load):
Product |
Startdate |
Enddate |
P1 |
03-01-2020 |
12/31/9999 |
P2 |
01-01-2010 |
12/31/9999 |
P3 |
02-02-2020 |
12/31/9999 |
P4 |
04-01-2020 |
12/31/9999 |
In target table product P3 and P4 are active records, from stage table again we are getting active records for same product. this is not expected one, we need to return status value as 1 if everything good returns value as 0.