Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I would like to concatenate two fields from two different tables loaded from an SQL database.
In order to clarify, I am going to put an example:
Field1 from Table1
Field2 from Table2
What I want to obtain is a
Field3 that is Field1_Field2
I know if Field1 and Field2 comes from one table, the script would look like this:
LOAD Field1 &'_'& Field2
From whatever.database.Table1
But in the case of having two tables, I dont know how to proceed. I would appreciate so much if you can help me on this.
Best regards.
Hello!
You must have field in database , which associates Field1 with Field2.
You can do like this, but it doesn't make sense (for examle Paris concatenate with Spain):
Countries:
LOAD * INLINE [
Country,values1
USA,60
Spain,70
Italy,65
France,68
];
Cities:
LOAD * INLINE [
City,values2
New York,5
Madrid,3
Milan,3
Paris,7
];
TempTableOuterJoin:
LOAD
Country
Resident Countries;
JOIN(TempTableOuterJoin)
LOAD
City
Resident Cities;
NoConcatenate
TableOuterJoin:
LOAD
City & '_' & Country,
Country,
City
Resident TempTableOuterJoin;
DROP TABLE TempTableOuterJoin;
We must create a new internal table QlikView or Qlik Sense that contains two fields with the correct data by connecting the two source tables SQL.
Hello!
You must have field in database , which associates Field1 with Field2.
You can do like this, but it doesn't make sense (for examle Paris concatenate with Spain):
Countries:
LOAD * INLINE [
Country,values1
USA,60
Spain,70
Italy,65
France,68
];
Cities:
LOAD * INLINE [
City,values2
New York,5
Madrid,3
Milan,3
Paris,7
];
TempTableOuterJoin:
LOAD
Country
Resident Countries;
JOIN(TempTableOuterJoin)
LOAD
City
Resident Cities;
NoConcatenate
TableOuterJoin:
LOAD
City & '_' & Country,
Country,
City
Resident TempTableOuterJoin;
DROP TABLE TempTableOuterJoin;
Thank you Anton for your quick response. Actually, I had another field that connected the two tables so the script you sent me also works but eliminating Noconcatenate line.