Skip to main content
Announcements
Get Ready. A New Qlik Learning Experience is Coming February 17! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to link these tables?

I have to join the tables based on the design below. I have three tables.

Table 1, Table 2 and Table3 with the column mentioned below.

Table 1 - Column A (PK)

Table 2 - Column B (FK)

From Table 1, for every value in column A, I need corresponding value in Table 2(Column B).

But When I filter with one more column (column X), I need to pick corresponding value in Table 3 (column Y)

and then I need to pick corresponding value in Table 2 (column B).

Table 1:

AX

   

Table 2:

YB

Table 3:

XY

How do I join these table while loading the data? Can someone help me?

Thanks in advance

3 Replies
Anonymous
Not applicable
Author

Try the script below. Change the ...."from [ ]" to include the source path of your data tables. You can change the join's to be left, inner, outer, etc or specify them as keeps instead of joins depending on your requirements.

//Script

TABLE1:

LOAD

A, X

FROM [TABLE1];

LEFT JOIN (TABLE1)

TABLE2:

LOAD

Y, B as A, B

FROM [TABLE2];

LEFT JOIN (TABLE1)

TABLE3:

LOAD

X,Y

FROM [TABLE3];

Not applicable
Author

Hi,

Thanks for your response.

so, you basically want to make a Left Join of two table with the Table 1.

But, what is "B as A" ? Why do we need to change the field B as A?

A in Table 1 is not same as B in Table 2.

I need to traverse in this way.

A (Table 1) -> X (Table 3) -> Y (Table 3) -> B (Table 2)

Anonymous
Not applicable
Author

The use of "as" in the load script is renaming the field. Two fields named the same is seen as the same in qlikview, so this is to distinguish.

I misunderstood the relationships of the fields between tables in the previous post.

The script below would be an option to associate the data.

//script

T1:

LOAD

A AS A1,

B AS B1,

A AS X3

FROM [source]

;

LEFT JOIN (T1)

T3:

LOAD

X AS X3,

Y AS Y3,

Y AS B2

FROM [source]

;

LEFT JOIN (T1)

T2:

LOAD

B AS B2,

Y AS Y2

FROM [source]

;