Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
D19PAL
Creator II
Creator II

Create the second table from the first table

This is what I want 

Original 

Name     Date 1                 order date              Id 
John       01/01/2010      01/01/2010        1 
John       01/01/2010      01/01/2010        1 
John        01/01/2010     01/01/2010        1 
John        01/01/2010     05/01/2010        2 
John        01/01/2010     05/01/2010       2 
John        01/01/2010     05/01/2010       2 
Paul         01/01/2010     01/01/2010       3 
Paul        01/01/2010      01/01/2010        3 
Paul        01/01/2010        01/01/2010      3 
Paul        01/01/2010       05/01/2010      4 
Paul        01/01/2010      05/01/2010       4 
Paul        01/01/2010      05/01/2010       4 

 

I want the before or After field added to the bottom table (Or in the original table) using the following code

 if(Date 1 = order date, 'Before',if(Date 1 < order date,'After )) as [Before_or_After] 

feel free to rewrite this if you need to.

This is how I want it

Name     Date 1                 order date              Id         Before of After
John       01/01/2010      01/01/2010        1                Before
John       01/01/2010      01/01/2010        1 
John        01/01/2010     01/01/2010        1 
John        01/01/2010     05/01/2010        2               After
John        01/01/2010     05/01/2010       2 
John        01/01/2010     05/01/2010       2 
Paul         01/01/2010     01/01/2010       3                Before
Paul        01/01/2010      01/01/2010        3 
Paul        01/01/2010        01/01/2010      3 
Paul        01/01/2010       05/01/2010      4                After
Paul        01/01/2010      05/01/2010       4 
Paul        01/01/2010      05/01/2010       4 

 

Sorry for starting a new post, the previous one wasn't allowing me to add a reply.

 

Thanks

0 Replies