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 load three tables

Hi all,

        I have three table.These table are containing various values.then how to load in three tables to one table and how to join these tables.

19 Replies
salto
Specialist II
Specialist II

Hi Mani,

I assume that the original data is like this: three different tables:

  1. One with Matching values (named Matching_table)
  2. Other with Not_Matching values (named  Not_Matching_table)
  3. Othe with Rejected values (named Rejected_table)

The way to load the three tables in a single Result_Table would be:

Result_Table:

Load

     'Matching' as Status,

     Value as ID

From Matching_table;

Load

     'Not_Matching' as Status,

     Value as ID

From Not_Matching_table;


Load

     'Rejected' as Status,

     Value as ID

From Rejected_table;

Hope this helps!

salto
Specialist II
Specialist II

Hello Mani,

     did you have the chance to try the proposed solution?

Regards!

Not applicable
Author

If you want some more information about Joins, read about it here: Understanding Join, Keep and Concatenate

Best Regards,

Lucas

Not applicable
Author

I can't load this tables.Because this a temporary Table.In three tables are converted from Two tables.My Script is,

Table1:

LOAD

     @1 as key,

     @5, SubField(@5,'-',1) as Field1

    

FROM

D:\QlikView\POC\Test1.txt

(txt, codepage is 1252, no labels, delimiter is spaces, msq, header is 1 lines);

join

Table2:

LOAD

     @1 as key,

     @7, SubField(@7,'.',1) as  Field2

FROM

D:\QlikView\POC\Test2.txt

(txt, codepage is 1252, no labels, delimiter is ' ', msq, header is 1 lines);

Matching:

load

Field1,Field2as Matching

resident Table1

where  Field1= Field2;

Not_Matching:

LOAD

Field2 as Not_Matching

resident Table1

where  not Exists(Field1,Field2);

join

LOAD

Field1 as Not_Matching

resident Table1

where  not Exists(Field2,Field1);

Cancel:

LOAD

     @1 as key,

     @4 as Rejected

        

FROM

D:\QlikView\POC\Test1.txt

(txt, codepage is 1252, no labels, delimiter is spaces, msq, header is 1 lines);

anything else,

salto
Specialist II
Specialist II

Hi,

Just put this after you script:


Result_Table:

Load

     'Matching' as Status,

     Field2 as ID

From Matching;

Load

     'Not_Matching' as Status,

     Field2 as ID

From Not_Matching;


Load

     'Rejected' as Status,

     Rejected as ID

From Cancel;

drop tables Matching, Not_Matching, Cancel;

Hope this helps!

Not applicable
Author

when i run the script, i got the following error,

salto
Specialist II
Specialist II

Sorry, my fault (please replace FROM with RESIDENT):

Result_Table:

Load

     'Matching' as Status,

     Field2 as ID

resident Matching;

Load

     'Not_Matching' as Status,

     Field2 as ID

resident Not_Matching;


Load

     'Rejected' as Status,

     Rejected as ID

resident Cancel;

drop tables Matching, Not_Matching, Cancel;

Not applicable
Author

This means you need to define the path for the file you're importing your information from! (e.g. From D:\MyFiles\Matching.xls) Otherwise your script should be correct.

Greetings,

Lucas

EDIT: Didn't see the whole conversation before, sorry

er_mohit
Master II
Master II

Load your table with concatenate function and add the one field for three table

like

table1:

load A,

B,

'Matching' as StatusField from table1;

concatenate(table1)

table2:

load C,

D,

'Non-Matching' as StatusField from table2;

concatenate(table1)

table3:

load E,

F,

'Rejected' as StatusField from table3;

Not applicable
Author

Thanks Jose,

                     Your Script is correct Solution for my Scenario,Thank you for your Commend.