Skip to main content
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

Loading two tables as one and having a where clause

I have 2 tables tableA and tableB.

I want to load them together with a LEFT JOIN and return the fields from tableA while using tableB fields in the where clause.

Something like this:

LOAD MT, MKA, moves FROM $(vPATH)\tableA.QVD (qvd);
LEFT JOIN (tableC) LOAD costart, coend, IDID FROM $(vPATH)\tableB.QVD (qvd)
WHERE (MT >= costart AND MT <= coend);


 I dont want to join the tables, i just want to use tableB as parameters for tableA 

3 Replies

In that case, may be all you need is to use ApplyMap

QlikView ApplyMap - Is It So Wrong?


I think I would go with the suggestion from Sunny but you could also use a join if you populate your start and end. It might be look like:

LOAD MT, MKA, moves FROM $(vPATH)\tableA.QVD (qvd);
LEFT JOIN (tableC) 
LOAD costart + iterno() -1 as MT, IDID FROM $(vPATH)\tableB.QVD (qvd)
WHILE costart + iterno() - <= coend;

Whereby you will further need  a common ID both loadings (and by the mapping-approach, too).

- Marcus

Contributor II
Contributor II


You have to do it in two steps: first do the join to have all fields in one table, and then load that intermediate table using the where clause.You will need an ID field to join the tables.  At the end You can only have the fields from TableA. 

Something like this:



ID, Field_1, Field_2, Field_3 from TableA.Qvd(qvd);
left join (TableA) 
LOAD ID, Parameter_1, Parameter_2 from TableB.qvd(qvd);

ID, Field_1, Field_2, Field_3
Resident TableA
Where Field_1 > Parameter_1 and Field_2 > Parameter_2;