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

How can I get the second table from the resident table

Hi Guys,

 

How can I get the bottom table from the top resident table?

Thanks

 

Top table Resident

NameDate 1order dateIdBefore_or_ after
John01/01/201001/01/20101Before
John01/01/201001/01/20101Before
John01/01/201001/01/20101Before
John01/01/201005/01/20102After
John01/01/201005/01/20102After
John01/01/201005/01/20102After
Paul01/01/201001/01/20103Before
Paul01/01/201001/01/20103Before
Paul01/01/201001/01/20103Before
Paul01/01/201005/01/20104After
Paul01/01/201005/01/20104After
Paul01/01/201005/01/20104After
     
     
What I need from the resident table In the table below.     
     
NameIdBefore_or After  
John1Before  
John2After  
Paul3Before  
Paul4After  
5 Replies
Saravanan_Desingh

Try this,

tab1:
LOAD * INLINE [
    Name, Date 1, order date, Id, Before_or_ after
    John, 01/01/2010, 01/01/2010, 1, Before
    John, 01/01/2010, 01/01/2010, 1, Before
    John, 01/01/2010, 01/01/2010, 1, Before
    John, 01/01/2010, 05/01/2010, 2, After
    John, 01/01/2010, 05/01/2010, 2, After
    John, 01/01/2010, 05/01/2010, 2, After
    Paul, 01/01/2010, 01/01/2010, 3, Before
    Paul, 01/01/2010, 01/01/2010, 3, Before
    Paul, 01/01/2010, 01/01/2010, 3, Before
    Paul, 01/01/2010, 05/01/2010, 4, After
    Paul, 01/01/2010, 05/01/2010, 4, After
    Paul, 01/01/2010, 05/01/2010, 4, After
];

tab2:
NoConcatenate
LOAD DISTINCT Name, Id, [Before_or_ after]
Resident tab1;

Drop Table tab1;
Saravanan_Desingh

Output:

commQV39.PNG

D19PAL
Creator II
Creator II
Author

What if I wanted to join the new bottom table back into the resident table (That is initially the main thing I want. I just asked in steps).

 

 

Saravanan_Desingh

Try something like this,

tab1:
LOAD * INLINE [
    Name, Date 1, order date, Id, Before_or_ after
    John, 01/01/2010, 01/01/2010, 1, Before
    John, 01/01/2010, 01/01/2010, 1, Before
    John, 01/01/2010, 01/01/2010, 1, Before
    John, 01/01/2010, 05/01/2010, 2, After
    John, 01/01/2010, 05/01/2010, 2, After
    John, 01/01/2010, 05/01/2010, 2, After
    Paul, 01/01/2010, 01/01/2010, 3, Before
    Paul, 01/01/2010, 01/01/2010, 3, Before
    Paul, 01/01/2010, 01/01/2010, 3, Before
    Paul, 01/01/2010, 05/01/2010, 4, After
    Paul, 01/01/2010, 05/01/2010, 4, After
    Paul, 01/01/2010, 05/01/2010, 4, After
];

Concatenate(tab1)
LOAD DISTINCT Name, Id, [Before_or_ after]
Resident tab1;
manoranjan_d
Specialist
Specialist

Hi D19PAl

Instead of resident load you can go with preceding load. 

Please clearly explain your requirement for join.

tab1:
Load
Distinct *;

LOAD * INLINE [
Name, Date 1, order date, Id, Before_or_ after
John, 01/01/2010, 01/01/2010, 1, Before
John, 01/01/2010, 01/01/2010, 1, Before
John, 01/01/2010, 01/01/2010, 1, Before
John, 01/01/2010, 05/01/2010, 2, After
John, 01/01/2010, 05/01/2010, 2, After
John, 01/01/2010, 05/01/2010, 2, After
Paul, 01/01/2010, 01/01/2010, 3, Before
Paul, 01/01/2010, 01/01/2010, 3, Before
Paul, 01/01/2010, 01/01/2010, 3, Before
Paul, 01/01/2010, 05/01/2010, 4, After
Paul, 01/01/2010, 05/01/2010, 4, After
Paul, 01/01/2010, 05/01/2010, 4, After
];