Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikwiz123
Creator III
Creator III

Join Tables for missing values

I have two different tables

TableA:

ID, Name, Dept

1, A, Clothes

2, B, Shoes

3, H, Utilities

6,-, Custom

 

Table B:

ID, Name

1, A

2, L

3, P

4, D

5, I

6, O

7, X

8, Q

9, M

10, S

 

How do I join Table B with Table A, to fill the missing 'Name' values in Table A, without disturbing the table structure

Output:

ID, Name, Dept

1, A, Clothes

2, B, Shoes

3, H, Utilities

6,O, Custom

Labels (1)
  • join

1 Solution

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

that needs a little more round about approach. you split and load your table a into 2 temporary tables. one with Name and one without (i.e. name ='-') and then perform the joins

see attached

View solution in original post

6 Replies
dplr-rn
Partner - Master III
Partner - Master III

 

 you could right join or load table B without ids from tableA and then concatenate 

or if you just want it as a dimension drop Name from tableA and leave Table B as dimension table 

whats the end result table you are looking for?

final answer depends on that.

qlikwiz123
Creator III
Creator III
Author

Hi,

my output should be 

Output:

 

TableA:

ID, Name, Dept

1, A, Clothes

2, B, Shoes

3, H, Utilities

6,O, Custom

 

I don't want all the rows to be concatenated from TableB, only fill up the missing 'Name' values in TableA from TableB.

dplr-rn
Partner - Master III
Partner - Master III

see sample script below

TableA:
load ID, Dept
;
load * inline [
ID, Name, Dept

1, A, Clothes

2, B, Shoes

3, H, Utilities

6,-, Custom
];

TableB:
left join(TableA)
load * inline [
ID, Name

1, A

2, B

3, H

4, D

5, I

6, O

7, X

8, Q

9, M

10, S
];

Capture.PNG

qlikwiz123
Creator III
Creator III
Author

Hi, thank you.

But this overrides the original 'Name' values in TableA with TableB.

I only want to fill the missing 'Name' values from TableB into TableA but not replace existing values.

 

I attached my sample qvw 

dplr-rn
Partner - Master III
Partner - Master III

that needs a little more round about approach. you split and load your table a into 2 temporary tables. one with Name and one without (i.e. name ='-') and then perform the joins

see attached

qlikwiz123
Creator III
Creator III
Author

Thank you. Let me look into this and get back to you