Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi community,
i load 2 tables in a script. E.g.
T1: contains field a
T2: contains filed b
now i want to subtract field a from field b as a new one. E.g. sum(a-b) as c.
Is this possible in my script?
Try something like this:
Table1:
Load part_no,
Stock
From <your source>;
Join // left/right/inner whicever is applicable
Load part_no,
Safety
From <your source>;
NoConcatenate
Final:
Load *,
(Stock-Safety) as Difference
Resident Table1;
Drop Table Table1;
That's only possible if you first combine the two tables into one table. You can use join for this.
T1: contains field a
join(T1)
T2: contains filed b
and need
T3:
load
a,
b,
a+b as c
resident T1
HI,
Do you want to calculate all combinations possible of sum(a-b)?
If so, you can do
JOIN(T1)
LOAD
b
RESIDENT
T2;
You'll now have your field a and b in the table T1 and you can do:
Concatenate
(T1)
LOAD
*,
sum(a-b)
RESIDENT
T1;
Otherwise, you should have at least one field in common in table T1 and T2 which will let you join field a to b.
Can you explain little more your need? And even join your qvw will be better.
Hi,
i have one field in common in both tables. Its 'part_no'. In table T1 is the stock in table T2 is the safety stock.
And now i need the difference between stock and safety stock.
Thanks for you support guys.
Try something like this:
Table1:
Load part_no,
Stock
From <your source>;
Join // left/right/inner whicever is applicable
Load part_no,
Safety
From <your source>;
NoConcatenate
Final:
Load *,
(Stock-Safety) as Difference
Resident Table1;
Drop Table Table1;
Hi,
Use applymap and bring the field you need from 2nd table to 1st table. Then do preceding load in 1st table and calculate the sum. That's the way I have done in many instances and it works fine.
thanks,
Rajesh Vaswani