Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.Code | Table2.Code |
---|---|
111 | AAA|111 |
111 | BBB|111 |
222 | - |
333 | CCC|333 |
I have no idea how to implement this in QV.
Hi kostak,
take a look at my little example - app.
HtH
Roland
Thanks,
Problem that Table1.Code field length can vary and I can't use Right(Code,3)
HI
Please find attachment
hope that helps
Hi again,
if you can rely on the pipe-symbol as seperator, try something like
SubField(Code,'|',1) AS Code1
RR
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
Code | Cod |
111 | AAA|111 |
111 | BBB|111 |
222 | - |
333 | CCC|333 |