Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
For example, I have a table like
Load * inline
[Year,Month,A,B,C
1994,1,'a',100,'x'
1994,'1','b',10,2,'y'
and so on...
]
I want to add rows like
1994,1,c,100/10,1....
Can anyone please help.
May be like this
Table:
Load * inline
[Year,Month,A,B,C
1994, 1, a, 100, x
1994, 1, b, 10, 2, y
];
TmpTable:
LOAD Year,
Month,
'c' as A,
B as B1
Resident Table
Where A = 'a';
Left Join (TmpTable)
LOAD Year,
Month,
'c' as A,
B as B2
Resident Table
Where A = 'b';
Concatenate(Table)
LOAD Year,
Month,
A,
B1/B2 as B
Resident TmpTable;
DROP Table TmpTable;
In script?
Yes. While loading the data i need to divide the field values.
May be like this
Table:
Load * inline
[Year,Month,A,B,C
1994, 1, a, 100, x
1994, 1, b, 10, 2, y
];
TmpTable:
LOAD Year,
Month,
'c' as A,
B as B1
Resident Table
Where A = 'a';
Left Join (TmpTable)
LOAD Year,
Month,
'c' as A,
B as B2
Resident Table
Where A = 'b';
Concatenate(Table)
LOAD Year,
Month,
A,
B1/B2 as B
Resident TmpTable;
DROP Table TmpTable;
Thank you for your help. That is the process we thought too. I want to know if there is any simpler way to achive this.