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

Multilple Left Join

Hi All,

Please consider the following scenario.

RTY:

LOAD * INLINE [

    F1, F2

    1, 11

    2, 12

    3, 13

    4, 14

    5, 15

    6, 16

    7, 17

    8, 18

    9, 19

    10, 20

];

 

Left JOIN(RTY)


LOAD * INLINE [
    F1, F333
    1, 21
    2, 22
    3, 23
    4, 24
    5, 25
    6, 26
    7, 27
    8, 28
    9, 29
    10, 30
];

Left JOIN(RTY)


LOAD * INLINE [
    F1, F333
    1, 31
    2, 32
    3, 33
    4, 34
    5, 35
    6, 36
    7, 37
    8, 38
    9, 39
    10, 40
];

OUTPUT:

F1F2F333
11121
21222
31323
41424
51525
61626
71727
81828
91929
102030

In the following scenario only the first left join is working, second left join is not working. Please let me know why and how to resolve it.

31 - 40 is not displayed please let me know why.

1 Solution

Accepted Solutions
Not applicable

If you want this:

Capture.PNG

Try with this script, first loading all F333 values, and then joining the tables:

RTY:

LOAD * INLINE [

    F1, F333

    1, 21

    2, 22

    3, 23

    4, 24

    5, 25

    6, 26

    7, 27

    8, 28

    9, 29

    10, 30

];

LOAD * INLINE [

    F1, F333

    1, 31

    2, 32

    3, 33

    4, 34

    5, 35

    6, 36

    7, 37

    8, 38

    9, 39

    10, 40

];

Right JOIN(RTY)

LOAD * INLINE [

    F1, F2

    1, 11

    2, 12

    3, 13

    4, 14

    5, 15

    6, 16

    7, 17

    8, 18

    9, 19

    10, 20

];

View solution in original post

9 Replies
Not applicable

hi

output looks like this,

F1F2F333F444
1112131
2122232
3132333
4142434
5152535
6162636
7172737
8182838
9192939
10203040

RTY:

LOAD * INLINE [

    F1, F2

    1, 11

    2, 12

    3, 13

    4, 14

    5, 15

    6, 16

    7, 17

    8, 18

    9, 19

    10, 20

];

Left JOIN(RTY)

LOAD * INLINE [

    F1, F333

    1, 21

    2, 22

    3, 23

    4, 24

    5, 25

    6, 26

    7, 27

    8, 28

    9, 29

    10, 30

];

Left JOIN(RTY)

LOAD * INLINE [

    F1, F444

    1, 31

    2, 32

    3, 33

    4, 34

    5, 35

    6, 36

    7, 37

    8, 38

    9, 39

    10, 40

];

flipside
Partner - Specialist II
Partner - Specialist II

Hi,

The second join is on the combination of BOTH columns (F1 & F333) and as those data combinations don't exist at that point, won't add anything. Are you trying to add a new column or new rows?

flipside

er_mohit
Master II
Master II

HII

Change the  name of your field i.e F333

duplicate field you write. (Rename it And you will got answer)

and rest of your code fine......

qv_jagan
Partner - Creator
Partner - Creator
Author

I wanted to new rows

flipside
Partner - Specialist II
Partner - Specialist II

Then you can use this ...

//Left JOIN(RTY)

concatenate LOAD * INLINE [

    F1, F333

    1, 31

    2, 32

    3, 33

    4, 34

    5, 35

    6, 36

    7, 37

    8, 38

    9, 39

    10, 40];

... but this creates no relationship between the new rows for F333 and F2 - is this expected? if not, maybe some sample data to give us context may help.

flipside

Not applicable

If you want this:

Capture.PNG

Try with this script, first loading all F333 values, and then joining the tables:

RTY:

LOAD * INLINE [

    F1, F333

    1, 21

    2, 22

    3, 23

    4, 24

    5, 25

    6, 26

    7, 27

    8, 28

    9, 29

    10, 30

];

LOAD * INLINE [

    F1, F333

    1, 31

    2, 32

    3, 33

    4, 34

    5, 35

    6, 36

    7, 37

    8, 38

    9, 39

    10, 40

];

Right JOIN(RTY)

LOAD * INLINE [

    F1, F2

    1, 11

    2, 12

    3, 13

    4, 14

    5, 15

    6, 16

    7, 17

    8, 18

    9, 19

    10, 20

];

qv_jagan
Partner - Creator
Partner - Creator
Author

Thanks Juan Gerardo Cabeza

I know it can be sovled as you mentioned.

I thought there would be some mistakes at my end when doing a left join at the second point.

I just wanted know to why the second left join was not working.

Not applicable

can u tell me the answer qv_jagan

qv_jagan
Partner - Creator
Partner - Creator
Author

RTY:

LOAD * F1, F333 from xxx

LOAD * F1, F333 from xxx

RIGHT JOIN

LOAD * F1, F2 from xxx

Please check Juan Gerardo Cabeza response for further clarifications.