Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Join Table


I would like to left join Table1 with Table2! Both Table should Show up in Qlikview and I would like to have all records from Table1 in table1 and only the matched ones in table 2!

How would the sript look like?

Thanks

Jürg

1 Solution

Accepted Solutions
jaygarcia
Contributor III
Contributor III

Hi Jürg,

The KEEP statement keeps both original tables and filters (keeps) rows in one table based on matching

rows in another table. It works very similar to JOIN.

So your solution would look like:

Table1:

LOAD * INLINE

[

A, B, C

1, 1, 1

2, 2, 2

3, 3, 3

];

Table2:

LEFT KEEP (Table1)

LOAD * INLINE

[

B, C, D

2, 2, 2

3, 3, 3

5, 5, 5

];

The result we get is the following two tables:

TABLE1
ABC
111
222
33

3

TABLE2
BCD
222
333

Hope this helps ,

Jay

View solution in original post

4 Replies
Not applicable
Author

hi jurg schlup,

example script for left join:

Qualify *;

UnQualify CUST_ID ;

DATA:

LOAD "CUST_ID",

     "123",

     "456";

SQL SELECT *

FROM TABLE_1;

Qualify *;

UnQualify CUST_ID ;

LEFT JOIN (DATA)

LOAD "CUST_ID",

     "ABC",

     "EFG";

SQL SELECT *

FROM TABLE_2;


hope it helps!

Regards,

Barathiraja

its_anandrjs

Hi,

You can try

Tab1:

Load * From Source;

Left Join

Tab2:

Load * From Source;

Or

Tab1:

Load * From Source;

Left Keep

Tab2:

Load * From Source;

Regards

Anand

jaygarcia
Contributor III
Contributor III

Hi Jürg,

The KEEP statement keeps both original tables and filters (keeps) rows in one table based on matching

rows in another table. It works very similar to JOIN.

So your solution would look like:

Table1:

LOAD * INLINE

[

A, B, C

1, 1, 1

2, 2, 2

3, 3, 3

];

Table2:

LEFT KEEP (Table1)

LOAD * INLINE

[

B, C, D

2, 2, 2

3, 3, 3

5, 5, 5

];

The result we get is the following two tables:

TABLE1
ABC
111
222
33

3

TABLE2
BCD
222
333

Hope this helps ,

Jay

Not applicable
Author

Thanks