Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
settu_periasamy
Master III
Master III

Left Join table field to First table

Hi,

i have 2 qvd file and i need to join them like the below code.

Table1:

  LOAD     A1,    

               B1,

               if(not isnull(D1),0,A1) as C1   // D1 Field is in 2nd qvd    

  FROM

  qvd\1.qvd

  (qvd) where exists(F1);

  Left Join 

LOAD   D1,  E1   FROM   qvd\2.qvd   (qvd) where exists(E1);

store table1 to table1.qvd;

I'm getting an error field not found. I know D1 field not available in the 1st qvd file.

But i need the C1 field, if D1 is not null.

Could you please give the suggestion?

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Table1:

Load

A1, B1 ,F1

from QVD1 ;


Left Join(Table1)

Load

D1,E1 ,F1

from QVD2 where Exists(F1);


Final:

Load *,

If(Not IsNull(D1),0, A1) AS C1

Resident Table1;


Drop Table Table1;


Regards,

Jagan.



View solution in original post

10 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

What are the key fields between Qvd1 and QVD2?  Where is the column F1?  can you attach some sample data and required output.

Regards,

Jagan.

settu_periasamy
Master III
Master III
Author

hi jagan,

QVD1 have A1, B1 and F1.

QVD2 have D1,E1 and F1.

I need the output like all the data from QVD1 and match the data from QVD2.

C1 is the calculated field from the QVD2.

i dont have the correct sample data.

jagan
Luminary Alumni
Luminary Alumni

Hi,

On what basis QVD1 and QVD2 are joined?  Is there any key fields?

Regards,

Jagan.

settu_periasamy
Master III
Master III
Author

Yes. F1 is the Key Field.

vardhancse
Specialist III
Specialist III

to do any left join, we need to have one common field.

MayilVahanan

Hi

Try like this

A:

Load * from Qvd1;

Left join(A)

Load * from Qvd2;

Noconcatenate

Load A1, B1, if(not isnull(D1),0,A1) as C1, F1, D1, E1 Resident A;

Drop table A;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable

Was F1 previously loaded? without that you can use it where exists. Or may be you haven't posted the entire script.

er_mohit
Master II
Master II

table1:

load

A1, B1 ,F1 from QVD1 ;


left join(table1)

table2:

load

D1,E1 ,F1 from QVD2 where exist(F1);


noconcatenate

Final:

load * resident table1;  //here you calculate the field for C1

drop table table1;

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Table1:

Load

A1, B1 ,F1

from QVD1 ;


Left Join(Table1)

Load

D1,E1 ,F1

from QVD2 where Exists(F1);


Final:

Load *,

If(Not IsNull(D1),0, A1) AS C1

Resident Table1;


Drop Table Table1;


Regards,

Jagan.