Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load From one table by values from another

Hello all,

Let's say I have these 2 tables I'm loading from. Table 1 contains sales orders, and Table 2 contains item information.

Table 1 has an order with Items 123, 234, and 456. Table 2 has those items but a bunch more as well. The goal would be to load ALL records from Table 1, and only load the records from Table 2 where those item numbers match the sales orders from Table 1.

This is probably relatively easy to do but I can't seem to get it working right.

Thank you!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

You can use left join or left keep depending on if you want one resulting table or two separate tables.

Table1:

Load * from ...sourcetable1;

Table2:

left keep

load * from ...sourcetable2;


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Table 1 ....

Left join

Table 2

in this way only values for table 2 corresponding to table 1 will be loaded

hope it hrlps

Not applicable
Author

By the way, I should have clarified I know I can do a left join or a left keep, but is there a more efficient way to do the load?

Gysbert_Wassenaar

You can use left join or left keep depending on if you want one resulting table or two separate tables.

Table1:

Load * from ...sourcetable1;

Table2:

left keep

load * from ...sourcetable2;


talk is cheap, supply exceeds demand
shree909
Partner - Specialist II
Partner - Specialist II

Hi

I think

u need to make the left join

Example:

Table1:

load sales_order,

item

from  file or database

left join(Table1)

load

item

from  database or flatfile

by doing this u will get all the records from table 1 and only matching records from table2.

..

Hope this helps

Not applicable
Author

Hi,

You can also use exists() function for the same. Refer attached sample file.

SalesOrder:

LOAD * INLINE [

    OrderNumber

    123

    234

    456

];

SalesDetails:

LOAD * INLINE [

    OrderNumber, OrderDetailNo, Amount

    123, 1 , 100

    234, 2 , 200

    456, 3, 800

    567, 5, 200

    678, 6, 600

    123, 2, 500

]

where exists(OrderNumber);

Regards,

Rahul