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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Bukan4x4
Contributor III
Contributor III

Left Join not show all data

Hello all, I have a issue with left join in my load data script. I have 2 tables like those:

TABLE A

project subproject

taxes

AA 11 0,1
AA 22 0,2
BB - 0,3

 Project BB don't have subproject

TABLE B

project subproject sales
AA 11 4
AA 22 5
BB - 2

 

I need join both tables for get this:

project subproject sales taxes
AA 11 4 0,1
AA 22 5 0,2
BB - 2 0,3

 

This is my script:

LEFT Join TABLE B
Load
project, subproject, taxes

Resident TABLE A;
DROP TABLE TABLE A;

And I get this:

project subproject sales taxes
AA 11 4 0,1
AA 22 5 0,2
BB - 2 -

 

No "taxes" join to the table for all "project" without "subproject".

Can anyone show me where is the error please?

 

Best regards

Labels (1)
1 Solution

Accepted Solutions
Bukan4x4
Contributor III
Contributor III
Author

Thanks to all for yours ideas, Finally I did this:

IF (len(subproject)='0','NA',subproject) as subproject

Works Perfect!

View solution in original post

3 Replies
ckarras22
Partner - Creator
Partner - Creator

Hello,

before your 2 tables you can write:

NullAsValue subproject;

 

vinieme12
Champion III
Champion III

I would suggest creating a composite key yourself for joining the tables

 


A:
Load project,subproject,project&'-'&subproject as KEYFIELD,taxes inline [
project,subproject,taxes
AA,11,0.1
AA,22,0.2
BB,,0.3
];

Left JOin (A)
Load project&'-'&subproject as KEYFIELD,sales inline [
project,subproject,sales
AA,11,4
AA,22,5
BB,,2
];


exit Script;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Bukan4x4
Contributor III
Contributor III
Author

Thanks to all for yours ideas, Finally I did this:

IF (len(subproject)='0','NA',subproject) as subproject

Works Perfect!