Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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 | ||
A | B | C |
1 | 1 | 1 |
2 | 2 | 2 |
3 | 3 | 3 |
TABLE2 | ||
B | C | D |
2 | 2 | 2 |
3 | 3 | 3 |
Hope this helps ,
Jay
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
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
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 | ||
A | B | C |
1 | 1 | 1 |
2 | 2 | 2 |
3 | 3 | 3 |
TABLE2 | ||
B | C | D |
2 | 2 | 2 |
3 | 3 | 3 |
Hope this helps ,
Jay
Thanks