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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare field from one table with another?

Hi,

I have one table loaded from an SQL database and one table loaded from an Excel sheet.

The structure is as follows:

Sheet1:

LOAD SMV,

Description,

..

..

..

FROM

(ooxml, embedded labels, table is [Sheet]);

Table1:

LOAD "STAFF_NR"

"JOB_DESC",

..

..

SQL SELECT * FROM Table1;

In Table1 I want to add a new field called "VER", it should compare JOB_DESC from Table1 with Description From Sheet1. When the condition is true, a "1" must be returned, otherwise "0".

In table1 I should add the following statement in Table1:

IF(JOB_DESC = Description,'1','0') as "VER"

How can I make sure that the field Description is known within Table1?

Is it by the use of resident?         

1 Reply
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

     Sheet1:
   LOAD SMV,
   Description,
   ..
   FROM
  
   (ooxml, embedded labels, table is [Sheet]);

   Left join 
   LOAD
"JOB_DESC" as Description,

        "JOB_DESC"; 

   SQL SELECT * FROM Table1;


   NewSheet:

   Load *,IF(JOB_DESC = Description,'1','0') as "VER" resident Sheet1;

   Drop table Sheet1;  Regards,

Kaushik Solanki  

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!