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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

look up in 2 tables

Hi everyone,

I would like to lookup the values between 2 tables, the lookup value in table1 has only part of the value same as table 2, like below:

Table1:

Load * inline [

Name1,ID

Chen Tai Man, 12345

Chan Wai, 23456

Wong Kai, 99999

Table2:

Load * inline [

Name2,Status

Tai Man, A

Wai, B

];

I would like to return the value in table1, for example field ID, when they find a match case.

Is it possible to do it in Qlik? Thanks for your help first!

1 Solution

Accepted Solutions
MayilVahanan

Hi

May be try like this

Table2:

Load * inline

[

Name2,Status

Tai Man, A

Wai, B

];

Join

Load * inline

[

Name1,ID

Chen Tai Man, 12345

Chan Wai, 23456

Wong Kai, 99999

];

FinalTemp:

LOAD *, If(WildMatch(Name1, '*'&Name2&'*'),1,0) AS Flag Resident Table2;

NoConcatenate

Final:

LOAD * Resident FinalTemp Where Flag = 1;

DROP Tables Table2, FinalTemp;

EXIT Script;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
MayilVahanan

Hi

May be try like this

Table2:

Load * inline

[

Name2,Status

Tai Man, A

Wai, B

];

Join

Load * inline

[

Name1,ID

Chen Tai Man, 12345

Chan Wai, 23456

Wong Kai, 99999

];

FinalTemp:

LOAD *, If(WildMatch(Name1, '*'&Name2&'*'),1,0) AS Flag Resident Table2;

NoConcatenate

Final:

LOAD * Resident FinalTemp Where Flag = 1;

DROP Tables Table2, FinalTemp;

EXIT Script;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
tamilarasu
Champion
Champion

Hi Ming,

Read the below link (Similar kind of question) and you might get a idea.

Left Join of 2 tables with a partial string match

scriptina.regular.png

Not applicable
Author

It works! Thanks so much!

Not applicable
Author

Thanks for your help too!