Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Understanding "JOIN" better.

Hi

I was trying something.

Am unable to figure it out. Please help me with understanding how JOIN works.

Temp:

LOAD * INLINE [

     P, Lat_p

     P1, 1

     P2, 2

];

JOIN

LOAD * INLINE [

     C, Lat_c

     C1, 3

     C2, 4

];

Final:

LOAD

     P,

//   C,

     Lat_p + Lat_c     as     Sum1,

     Lat_p * Lat_c     as     Mult

RESIDENT Temp;

When I take a Straight table with P and C in Dimensions and Sum1 and Mult in Expressions, I get this.

PCLat_PLat_CSum1Mult
P1C113--
P1C214--
P2C123--
P2C224--

But if I put field "C" also during loading "Final", then I get what I want.

PCLat_PLat_CSum1Mult
P1C11343
P1C21454
P2C12356
P2C22468

Could someone help me understand why this works and the first case does not?

Many regards

Ragha

6 Replies
sujeetsingh
Master III
Master III

Hi,

go to these links you will get a better idea of join .

http://qlikshare.com/877

http://www.qlikviewaddict.com/2012/03/explaining-joins.html

The second link is the best and simple one .

Not applicable
Author

HI,

To get the expected result.. you should put "NoConcatenate" before load "Final" table.

Check the script below..

Temp:

LOAD * INLINE [

     P, Lat_p

     P1, 1

     P2, 2

];

JOIN

LOAD * INLINE [

     C, Lat_c

     C1, 3

     C2, 4

];

Final:

NoConcatenate

LOAD

     P,

     C,

     Lat_p + Lat_c     as     Sum1,

     Lat_p * Lat_c     as     Mult

//          Lat_p

//          ,Lat_c

RESIDENT Temp;

DROP Table Temp;

Not applicable
Author

hi

your first code does not work because,

Sum1 and Mult fields  contain in Final table, and both field made on the basis of  P and C, so, In straight table qlikview calculate  Sum1 and Mult on the basis of  P and C , then P and C must contain in Final table.(that is in the same table).

note- If you made any field based on calculation then fields must contain in the same table for right working.

thus this is the right code.

Temp:

LOAD * INLINE [

     P, Lat_p

     P1, 1

     P2, 2

];

JOIN

LOAD * INLINE [

     C, Lat_c

     C1, 3

     C2, 4

];

Final:

LOAD

     P,

   C,

     Lat_p + Lat_c as  Sum1,

     Lat_p * Lat_c as  Mult

RESIDENT Temp;

Not applicable
Author

Hi.

Thanks for your response.

Both the sites give a good insight on JOINS.

But I still am stuck with why my problem is not getting solved in one case and gets solved in the other.

Thanks again

Not applicable
Author

Hi karthiks

Thanks for your response.

If I navigate to Edit script and then to Table viewer, irrespective of NOCONCATENATE the tables and the links remain same.

My question is why should we load both Field P and Field C for getting the correct answer.

Why does not the problem work if only Field P is loaded into "FINAL"?

I am just curious on how JOIN works.

Many thanks

Not applicable
Author

Hi vishwaranjan

Thanks for your response.

This is what I understand should have happened.

By the end of JOIN, there is 1 table named "Temp" which has all the 4 fields in it.

In the "Final" table, I thought it would be enough to load 1 field.

But obviously I am wrong.

I think, I kind of understand now.

Thanks again