Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lmenendez_grupo_pinero
Contributor III
Contributor III

LEFT JOIN LOAD FOR A GAP

Hi,

I wonder if there is possible to make a left join load with gaps instead of finding the exact value.

For exemple I can join table like :

100,A

110,B

120,C

130,D ...

but if I have a value '104' I wil not have a letter.

I am looking for the way to left join load letter 'A' to all the values betwen 100 and 109, letter 'B' to all teh values betwen 110 and 119 , and so on.

 

Is it possible?

Thank you

 

 

1 Solution

Accepted Solutions
lmenendez_grupo_pinero
Contributor III
Contributor III
Author

Espectacular explanation for a begginer like me, thank you very much Marco.

View solution in original post

5 Replies
stevejoyce
Specialist II
Specialist II

lmenendez_grupo_pinero
Contributor III
Contributor III
Author

Quite difficult to understand the command but I will try it , Thank you very much.

MarcoWedel

Hi,
one example:

tabLetterTemp:
LOAD * Inline [
Val, Letter
100,A
110,B
120,C
130,D
150,E
180,F
];

tabLetter:
LOAD Val as MinVal,
     Alt(Previous(Val)-1, 1000) as MaxVal,
     Letter    
Resident tabLetterTemp
Order By Val Desc;

DROP Table tabLetterTemp;

table1:
LOAD Ceil(Rand()*100+100) as Value
AutoGenerate 50;

Left Join (table1)
IntervalMatch (Value)
LOAD MinVal, MaxVal     
Resident tabLetter;

Left Join (table1)
LOAD * Resident tabLetter;

DROP Fields MinVal, MaxVal From table1;

 

MarcoWedel_0-1637340593020.png

MarcoWedel_1-1637340600623.png

hope this helps

Marco

lmenendez_grupo_pinero
Contributor III
Contributor III
Author

Espectacular explanation for a begginer like me, thank you very much Marco.

MarcoWedel

You're welcome.
Please close your thread by accepting an answer as solution.
Thanks
Marco