Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I have two table
Table1:
Load * Inline [A, B
1, 10
2, 20
3, 40
]
Table2:
Load * Inline [Month, Value
Jan, 0
Feb, 0
Mar, 0
..
Dec,0
]
I wanted a new table
like
Test:
A B Month Value
1, 10, Jan, 0
1, 10, Feb, 0
--------
1, 10, Dec, 0
2, 20, Jan, 0
2, 20, Feb, 0
--------
2, 20, Dec, 0
3, 40, Jan, 0
3, 40, Feb, 0
-----
3, 40, Dec, 0
Can anyone please help me on this.
Thanks
karthik
Hi,
You can join both the tables directly.
Please try the below code.
Table1:
Load * Inline [A, B
1, 10
2, 20
3, 40
];
join
Table2:
Load * Inline [Month, Value
Jan, 0
Feb, 0
Mar, 0
..
Dec,0
];
It seems like a Cartesian Product. Have you tried this:
Table1:
Load * Inline [
A, B
1, 10
2, 20
3, 40
]
Join (Table1)
Load * Inline [
Month, Value
Jan, 0
Feb, 0
Mar, 0
..
Dec,0
]
Table1:
Load * Inline [
A, B
1, 10
2, 20
3, 40
];
Join (Table1)
Load * Inline [
Month, Value
Jan, 0
Feb, 0
Mar, 0
..
Dec,0
];
Attaching a qvw for reference:
Script:
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
Table1:
Load * Inline [
A, B
1, 10
2, 20
3, 40
];
Join (Table1)
Load Date#(Month, 'MMM') as Month, Value Inline [
Month, Value
Jan, 0
Feb, 0
Mar, 0
Apr, 0
May, 0
Jun, 0
Jul, 0
Aug, 0
Sep, 0
Oct, 0
Nov, 0
Dec, 0
];
Output in table box: