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: 
Not applicable

Left join referencing fields in both tables

Hi all,

is it possible to do a join in QV while, at the same time referencing fields from both tables?

Let's say i have table A and table B. I'm left joining table B to A using key field [EntryNo], but only where [InvovicedQuantity] in table A is <> 0. Is the possible to do that in one join?

Or do I have to join first and than resident load from A while putting 0 or Null in the joined fields where InvoicedQuantity is 0?

Thanks for your help,

Marko

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Hi Marko,

Try this:

LOAD EntryNo,
InvoicedQuantity
FROM TableA
WHERE InvoicedQuantity <> 0;
LEFT JOIN
LOAD EntryNo,
Other
FROM TableB;

Regards,

Gordon

View solution in original post

3 Replies
Not applicable
Author

Hi Marko,

Try this:

LOAD EntryNo,
InvoicedQuantity
FROM TableA
WHERE InvoicedQuantity <> 0;
LEFT JOIN
LOAD EntryNo,
Other
FROM TableB;

Regards,

Gordon

Not applicable
Author

Hi Gordon, thanks for your answer.

I'm already doing it like that (actually im using a iszero flag-field instead of a where clause, but it's a same principle). What I was looking for is all-in-one-join solution. I guess it's not possible to do it the way i have imagined it.

Cheers,

Marko

johnw
Champion III
Champion III

How about this?

LOAD
EntryNo
,InvoicedQuantity
,if(InvoicedQuantity,EntryNo) as InvoicedEntryNo
FROM TableA
;
LEFT JOIN
LOAD
EntryNo
,Other
FROM TableB
WHERE EXISTS(InvoicedEntryNo,EntryNo)
;
DROP FIELD InvoicedEntryNo
;