Dear folks,
Find my requirement and provide me a better solution
SOURCE_PRODUCT_METRICS_AID | ACCOUNT_ID | PRODUCT_CATALOG_ID | PRODUCT_METRICS_DIMENSION_ID | START_DATE_ID | END_DATE_ID | START_DATE | END_DATE | ACTIVE_IND | COUNTRY_ID | PREV_FORMULARY_STATUS | CURR_FORMULARY_STATUS | Cluster |
sp1 | ac1 | pc1 | pm1 | a1 | b1 | 1/10/2016 | 15/10/2016 | 1 | 67 | Null | In Progress | Neutral |
sp2 | ac2 | pc2 | pm2 | c1 | d1 | 1/11/2016 | 15/11/2016 | 1 | 67 | Null | Restricted | Neutral |
sp3 the above data is loading first time from data base and the below data is been changed in next day along with old records so now i want to find the logic which is how many records been changed and how many are new and how many not been changed | ac3 | pc3 | pm3 | c3 | d3 | 23/11/2016 | 1/1/9999 | 1 | 67 | Null | Regional Committee | Neutral |
SOURCE_PRODUCT_METRICS_AID | ACCOUNT_ID | PRODUCT_CATALOG_ID | PRODUCT_METRICS_DIMENSION_ID | START_DATE_ID | END_DATE_ID | START_DATE | END_DATE | ACTIVE_IND | COUNTRY_ID | PREV_FORMULARY_STATUS | CURR_FORMULARY_STATUS |
sp1 | ac1 | pc1 | pm1 | a1 | b1 | 1/10/2016 | 15/10/2016 | 1 | 67 | Null | In Progress | + |
sp1 | ac1 | pc1 | pm1 | a2 | b2 | 16/10/2016 | 31/10/2016 | 1 | 67 | In Progress | Approved | active |
sp2 | ac2 | pc2 | pm2 | c1 | d1 | 1/11/2016 | 15/11/2016 | 1 | 67 | Null | Restricted | - |
sp2 | ac2 | pc2 | pm2 | c2 | d2 | 16/11/2016 | 23/11/2016 | 1 | 67 | Restricted | Rejected | active |
sp3 | ac3 | pc3 | pm3 | c3 | d3 | 23/11/2016 | 1/1/9999 | 1 | 67 | Null | Regional Committee | nc neutral |
sp4 | ac4 | pc4 | pm4 | c4 | d4 | 23/11/2016 | 1/1/9999 | 1 | 67 | Null | Rejected | new- |
sp5 | ac5 | pc5 | pm5 | c5 | d5 | 23/11/2016 | 1/1/9999 | 1 | 67 | Null | Unrestricted | new+ |
sp6 | ac6 | pc6 | pm6 | c6 | d6 | 23/11/2016 | 1/1/9999 | 1 | 67 | Null | Not Appicable | new neutral |
cluster change indicator | new/nochange/+/- |
|
| | | Id | count |
Positive Change | | 1,7 | 0+1+0+1=2 |
| | | sp1, sp5 |
Neutral Change | | 8 | 1 |
| | | sp6 |
Negative Change | 3,6 | 0+0+1+1=2 |
sp2, sp4 |