Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

tables joining question

Hello,

My question is how I can join two columns from the different tables.

In the SQL it can be something like that:

Select Table1.Code, Table2.Code

From Table1

Left Join Table2

     on Right(Table2.Code, Len(Table1.Code)) = Table1.Code

Table1:

Code
111
222
333

Table2:

Code
AAA|111
BBB|111
CCC|333

Final table:

Table1.CodeTable2.Code
111AAA|111
111BBB|111
222-
333CCC|333

I have no idea how to implement this in QV.

5 Replies
Not applicable
Author

Hi kostak,

take a look at my little example - app.

HtH

Roland

Not applicable
Author

Thanks,

Problem that Table1.Code field length can vary and I can't use Right(Code,3)

MayilVahanan

HI

Please find attachment

hope that helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi again,

if you can rely on the pipe-symbol as seperator, try something like

SubField(Code,'|',1) AS Code1

RR

er_mohit
Master II
Master II

Try this code

here two option two remve pipeline

see here copy and paste script and use two fields Code and Cod in table box

Table1:

  LOAD * Inline [

Code

111

222

333

];

  table2:

LOAD  subfield(Code,'|',2) as Code,

//mid(Code,index(Code,'|')+1,3)as Cod,

Code as Cod;

LOAD * Inline [

Code

AAA|111

BBB|111

CCC|333

];

output like this

CodeCod
111AAA|111
111BBB|111
222 -
333CCC|333