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: 
annick
Contributor III
Contributor III

Left Join within the same table

Hello,

I have a table with 3 columns : A,B,C.

Example:

ABC
101X1
102Y1
101 2
102 2

For each line with column C = 2, I would like to retrieve the line (in the same table) with the same value in column A and with column C = 1; Once the match is found, the value of Column B should be copied 

Example above would result in:

ABC
101X1
102Y1
101X2
102Y2

As I have a big volume of data, I would like an optimized way to do this operation and appreciate your advice.

Many thanks in advance.

Annick

Labels (1)
  • join

1 Reply
dplr-rn
Partner - Master III
Partner - Master III

not sure if there are any fruther subtleties involved in your requriement but below approach should work for you

first load values where column b is not empty in a map

i.e.

BColMap:

mapping load

A,B from xyz where len(B)>0;

AB
101X
102Y

 

then while loading your actual  table

 

load

A

,if(len(B)>0,B,applymap('BColMap',A,'')) as B

,C

from xyz;