Hi Ray,
I missed the last set of records in the above example i.e.
Code: Select all
-------------------
Current data :
-------------------
Name : xyz
State : new york
Start Date :01-JAN-2009
End Date :31-JAN-2009
Name : xyz
State : new york
Start Date :01-FEB2009
End Date :28-FEB-2009
Name : xyz
State : Mass
Start Date :01-MAR-2009
End Date :31-MAR-2009
Name : xyz
State : new york
Start Date :01-APR-2009
End Date :31-APR-2009
-------------------------
Changed data :
---------------------
Name : xyz
State : new york
Start Date :01-JAN-2009
End Date :28-FEB-2009
Name : xyz
State : Mass
Start Date :01-MAR-2009
End Date :31-MAR-2009
Name : xyz
State : new york
Start Date :01-APR-2009
End Date :31-APR-2009
In this case the above query will not yield the desired results .
I think the lag/lead option by suggested by
Changming would work,but need to explore the same.
One way is to process the records using stage variables in a transformer after they are sorted . Are there any other options to do it in data stage ?
Second approach was to sort the data based on the name,start date,end date fields and split into two streams using a copy stage to pass through two remove duplicate stages so as to retain the first and the last record,thereby picking the min and max dates. The only problem being in is I will not be able to join back the two streams .
Thanks again and appreciate your inputs on the same.
Regards,
Vinod