Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Join two tables and fill up null values from both tables

I have two Tables below. They have the same key and field. The reason to merge the two tables is that I want to fill up the null values in TableA with values from TableB but still keep all key in from both tables.

TableA:

KeyField
110
2
330

TableB:

KeyField
220
440

The merged table should be look like:

KeyField
110
220
330
440

Thank you in advance!

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi Yuan,

Try:

Table1:

LOAD * INLINE [

    Key, Field1

    1, 10

    2,

    3, 30

];

Outer Join(Table1)

LOAD * INLINE [

    Key, Field2

    2, 20

    4, 40

];

Table:

LOAD

Key,

Alt(Field1,Field2) as Field

Resident Table1;

Drop Table Table1;

Regards

Andrew

View solution in original post

3 Replies
sushil353
Master II
Master II

Hi,

Try something like this:


LOAD *,len(Field) Inline
[
Key,Field
1,10
2
3,30
]
where  len(Field)>0;

Concatenate
TableB:
load*,len(Field)
Inline
[
Key,Field
2,20
4,40
]
;

HTH

Sushil

effinty2112
Master
Master

Hi Yuan,

Try:

Table1:

LOAD * INLINE [

    Key, Field1

    1, 10

    2,

    3, 30

];

Outer Join(Table1)

LOAD * INLINE [

    Key, Field2

    2, 20

    4, 40

];

Table:

LOAD

Key,

Alt(Field1,Field2) as Field

Resident Table1;

Drop Table Table1;

Regards

Andrew

Not applicable
Author

Thanks for your help. Sushil

What if there is no value for the additional Key = 5 in TableA, there are still no values from TableB? How could I keep key =5 with null value?