Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
calvin_wee
Creator
Creator

Multiple table join

Hi,

I am having 2 sets of data that I need to join them but not able to get the join right.

Load Table A

Left Join Table B

Concatenate Table C

Left Join Table D

Joining Table A, B, C is successful but when I LEFT JOIN Table D, all the data in D is loaded instead of Left Join.

Any Advise?

Thanks in Advance.

1 Solution

Accepted Solutions
calvin_wee
Creator
Creator
Author

What happened is that when I commented the last statement and stops at SQL C, the data is correct.

When I continue with SQL D, instead of Left Join, I get 100% of SQL D data that is not desired.

Somehow it has become Right Join.

View solution in original post

6 Replies
hector_munoz
Specialist
Specialist

Hi Calvin,

Could you attach the script sentences?

Regards,
H

calvin_wee
Creator
Creator
Author

Hi,

Thanks for your reply. Please see below simplified form:

LOAD PRNo,

     PONo,

     Approver1;

[PRPO Information]

[SQL A]

left join ([PRPO Information])

LOAD Plant,
     CRFNo,
     PRNo,
     PRId,
     RequestorID,
     Requestor,
     RequestorMAIL,
     CostCtr,
     CostCtrName,
     Stage,
     BuyerCode,
     Buyer,
     PRDesc,
     VendorCode,
     VendorName,
     PRSubmitDT,
     InSystem;

[SQL B]

Concatenate

LOAD Plant,
     CRFNo,
     PRNo,
     PRId,
     RequestorID,
     Requestor,
     RequestorMAIL,
     CostCtr,
     CostCtrName,
     Stage,
     BuyerCode,
     Buyer,
     PRDesc,
     VendorCode,
     VendorName,
     PRSubmitDT,
     InSystem,
     ApprovalStageCode,
     Approver1,
     Approver2,
     ApproverStartDT;

[SQL C]

LOAD PRNo,
     CALRequired,
     MCFRequired;
    
left join ([PRPO Information])

[SQL D]

hector_munoz
Specialist
Specialist

Hi Calvin,

Is hard for me to see where is the problem without the full code. Maybe the problem is in some part of [SQL D]...

Regards,

H

Kushal_Chawda

try like below

[PRPO Information]:

LOAD PRNo,

     PONo,

     Approver1;

[PRPO Information]

left join ([PRPO Information])

LOAD Plant,
     CRFNo,
     PRNo,
     PRId,
     RequestorID,
     Requestor,
     RequestorMAIL,
     CostCtr,
     CostCtrName,
     Stage,
     BuyerCode,
     Buyer,
     PRDesc,
     VendorCode,
     VendorName,
     PRSubmitDT,
     InSystem;

Concatenate ([PRPO Information])

LOAD Plant,
     CRFNo,
     PRNo,
     PRId,
     RequestorID,
     Requestor,
     RequestorMAIL,
     CostCtr,
     CostCtrName,
     Stage,
     BuyerCode,
     Buyer,
     PRDesc,
     VendorCode,
     VendorName,
     PRSubmitDT,
     InSystem,
     ApprovalStageCode,
     Approver1,
     Approver2,
     ApproverStartDT;

   
left join ([PRPO Information])

LOAD *

FROM Source D;

Not sure about below part

[SQL C]

LOAD PRNo,
     CALRequired,
     MCFRequired;

calvin_wee
Creator
Creator
Author

What happened is that when I commented the last statement and stops at SQL C, the data is correct.

When I continue with SQL D, instead of Left Join, I get 100% of SQL D data that is not desired.

Somehow it has become Right Join.

calvin_wee
Creator
Creator
Author

Thank you all for your valuable inputs.

We managed to resolve as the wrong was putting LOAD before JOIN.

Once changed to JOIN then LOAD, it is ok.