Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
saifuddin
Contributor III
Contributor III

dates from different fields

Hi All,

I need help with a task I have been trying to solve. I have table look like this

 

saifuddin_0-1586997972759.png

 

 

Source code

saifuddin_1-1586997972761.png

 

 

It imports no rows. I want to import only rows where Start_Date >  M_Start_Date

Essentially, for the current data, I am expecting to see only Start_Date 9/03/2020 to get imported.

 

Regards,

Saif

Labels (1)
  • dates

1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

Raw:
load * INLINE [ 
Person_ID,unit_ID,Start_Date,M_Start_Date
27276155,1234,23/03/2018,
27276155,1234,9/03/2020,
27276155,3611,23/04/2019,23/04/2019
];

M_Start:
load distinct
Person_ID,Date#(M_Start_Date,'DD/MM/YYYY')as M_Start_Date
resident Raw
where len(M_Start_Date)>0;

left join(M_Start)

tempData:
load Person_ID,unit_ID,Date#(Start_Date,'DD/MM/YYYY')as Start_Date
resident Raw;

drop table Raw;
NoConcatenate
Data:
load *
resident M_Start
where Start_Date > M_Start_Date;

drop table M_Start;
exit SCRIPT;

View solution in original post

1 Reply
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

Raw:
load * INLINE [ 
Person_ID,unit_ID,Start_Date,M_Start_Date
27276155,1234,23/03/2018,
27276155,1234,9/03/2020,
27276155,3611,23/04/2019,23/04/2019
];

M_Start:
load distinct
Person_ID,Date#(M_Start_Date,'DD/MM/YYYY')as M_Start_Date
resident Raw
where len(M_Start_Date)>0;

left join(M_Start)

tempData:
load Person_ID,unit_ID,Date#(Start_Date,'DD/MM/YYYY')as Start_Date
resident Raw;

drop table Raw;
NoConcatenate
Data:
load *
resident M_Start
where Start_Date > M_Start_Date;

drop table M_Start;
exit SCRIPT;