Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
alwinsch
Creator
Creator

Use load statement in other sql statement

Hi,

I have a query, and with this result (Table_A)

i want to use it in another query in the script editor.

Is this possible like this.

Table_A:

Select ID_A from AAA;

Table_B:

Select * from BBB

where id in (LOAD ID_A from Table_A)
;

Or do i have to use a loop:

Get one value from Table_A go through the loop

Store result in Table_B and then get next value of Table_A?

I know it works like this, but i takes a lot of time, because of the big data

kind regards,

Alwin

2 Replies
Not applicable

Try where exists() function.

Table_A:

Load ID_A as ID

from AAA;


Table_B:

Load ID, * from BBB

where exists(ID);

maxgro
MVP
MVP

you have different possibilities

replace my load * inline with your sql select ....

with keep (tables associated)

Table_A:

load * inline [

ID_A

1

2

3

4

5

];

TableB:

left Keep (Table_A) load id as ID_A, val;

load * inline [

id,val

2,2

4,4

6,6

];

with exists (tables associated), see previous answer

with exists (tables not associated)

Table_A:

load * inline [

ID_A

1

2

3

4

5

];

TableB:

load * where exists(ID_A, id);

load * inline [

id,val

2,2

4,4

6,6

];