Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have 2 table like below
TableA:
Country,Value:
A1,12
A2,23,
A3,34
TableB:
Country,Value:
B1,122
B2,232
B3,342
and I want to create a table like
FinalTable:
KEY,CountryA,CountryB
1,A1,B1
2,A1,B2
3,A1,B3
4,A2,B1
5,A2,B2
6,A2,B3
7,A3,B1
8,A3,B2
9,A3,B3
Whats the easiest way to do that inside the script??
TableA:
Load * Inline
[
Country,Value
A1,12
A2,23,
A3,34
];
NoConcatenate
TableB:
Load * Inline
[
Country,Value
B1,122
B2,232
B3,342
];
Load Distinct Country as CountryA Resident TableA;
Join
Load Distinct Country as CountryB Resident TableB;
Drop Tables TableA, TableB;
TableA:
LOAD * INLINE [
CountryA,ValueA
A1,12
A2,23
A3,34 ];
TableB:
LOAD * INLINE [
CountryB,ValueB
B1,122
B2,232
B3,342 ];
OUTER JOIN (TableA)
LOAD *
RESIDENT TableB;
DROP TABLE TableB;
FinalTable:
LOAD
RowNo() as Key,
CountryA,
CountryB
RESIDENT TableA;
DROP TABLE TableA;
exit script;