Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

scripting help

tab1

--------

id  name

---------

1    a

2    b

3    c

tab2

--------

id  name

---------

1    a

4    c

5    f

I want to find out those list of records

only present in tab1 and tab2

I want to implement it in the script level

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi,

Using the Exists() clause would do, among some other ways:

tab1: 
LOAD * INLINE [ 
id, name 
1, a 
2, b 
3, c 
];  
  
tab2: 
LOAD * INLINE [ 
id2, name2 
1, a 
4, c 
5, f 
]; 
  

InBothTables:
LOAD *,
1 AS Dummy 
RESIDENT tab1 
WHERE Exists(id2, id); 
CONCATENATE LOAD id2 as id,
name2 as name,
1 AS Dummy 
RESIDENT tab2 
WHERE Exists(id, id2); 
 

DROP TABLES tab1, tab2;
DROP FIELD Dummy

Hope that helps.

Miguel

View solution in original post

4 Replies
Miguel_Angel_Baeyens

Hi,

Using the Exists() clause would do, among some other ways:

tab1: 
LOAD * INLINE [ 
id, name 
1, a 
2, b 
3, c 
];  
  
tab2: 
LOAD * INLINE [ 
id2, name2 
1, a 
4, c 
5, f 
]; 
  

InBothTables:
LOAD *,
1 AS Dummy 
RESIDENT tab1 
WHERE Exists(id2, id); 
CONCATENATE LOAD id2 as id,
name2 as name,
1 AS Dummy 
RESIDENT tab2 
WHERE Exists(id, id2); 
 

DROP TABLES tab1, tab2;
DROP FIELD Dummy

Hope that helps.

Miguel

Not applicable
Author

You can do Inner Join between the tables.

Both:

LOAD ID, NAME AS T1_NAME FROM TAB1;

INNER JOIN

LOAD ID, Name as T2_NAME FROM TAB2;

These two tables Join in ID key.

CELAMBARASAN
Partner - Champion
Partner - Champion

May be you can try with inner keep.

tab1:

Load

     id,

     name

FROM ...

tab2:

NoConcatenate

Inner Keep

Load

     id,

     name

FROM ...

Anonymous
Not applicable
Author

may be my expression was wrong.

I took help from   your query and modified this.It is working fine.

Thanks to all for their contribution.

InBothTables:  

LOAD *, 

1 AS Dummy   

RESIDENT tab1   

WHERE not Exists(id2, id);   

CONCATENATE

LOAD id2 as id, 

name2 as name, 

1 AS Dummy   

RESIDENT tab2   

WHERE not Exists(id, id2);   

   

DROP TABLES tab1, tab2; 

DROP FIELD Dummy ;