Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bringing value from table to table

I have a main table with fields (from SQL):

ID,

YearMonth,

Date,

Sell_price

Cost_price

now i load a table a (from excel) with fields

YearMonth,

Cost_Price_Per_Month

How do I bring Cost_Price_Per_Month value (from the excel table)  to the Cost_Price on first table to make a calculation on it.

In the script level.

Thank You.

1 Reply
Not applicable
Author

table_1:

load

ID,

YearMonth,

Date,

Sell_price,

Cost_price

from .....;

inner join (table_1)

load YearMonth, Cost_Price_Per_Month

from

./excel....;

table_2:

load ID, YearMonth, Date, Sell_Price, if(isnull(Cost_Price), Cost_Price_Per_Month, Cost_Price) as new_cost_price

resident table_1;

drop column Cost_Price, Cost_Price_Per_Month from table_2;

drop table_1;