Qlik Community

Ask a Question

New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Announcements
Do More with Qlik - for Beginners and Beyond, Topic: Qlik Replicate on January 21, 2PM EST. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

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)
1 Solution

Accepted Solutions
Partner
Partner

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
Partner
Partner

 

 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.

Creator II
Creator II

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.

Partner
Partner

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

Creator II
Creator II

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 

Partner
Partner

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

Creator II
Creator II

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