Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing two column values

Hi All,

I have to compare the values present in two columns. But the columns are located in different tables. e.g. I have to compare values of Column A with the values of Column B. Column A is present in Table A whereas Column B is present in table B. How do I compare them in the script?

7 Replies
robert_mika
Master III
Master III

Do you have only one field per table?

Do they have any common column?

What's is expected result?

Yes/NO or values that exist in one column only?

Not applicable
Author

Both the tables have multiple columns.

They have a common column.

The expected output should be Yes/No based on the match found.

Anonymous
Not applicable
Author

I think you should use exists() function if you want to do this in the script.

robert_mika
Master III
Master III

Could you post sample of data?

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I think you can bring both field into a temp table, from there you can then use IF statement to check field value and create a YES/NO field. Finally left join or ApplyMap the new field back to any of the tables.

robert_mika
Master III
Master III

09-Apr-15 4-16-08 PM.jpg

T1:

LOAD Num AS Num,

     Boom as Boom1

FROM

COMAPRE.xlsx

(ooxml, embedded labels, table is Sheet1);

temp:

LOAD Num as Num,

lookup('Boom1','Num',Num,'T1') as Boom1, 

     Boom as Boom2

FROM

COMAPRE.xlsx

(ooxml, embedded labels, table is Sheet2);

final:

load Num,

Boom1,

Boom2,

If(Boom1=Boom2,'Yes','No') as Compare

Resident temp;

drop table T1,temp

09-Apr-15 4-14-42 PM.jpg

beck_bakytbek
Master
Master

Cool Stuff, very useful and powerful

Thanks a lot

Beck