1 Reply Latest reply: Jun 26, 2014 7:36 PM by Ramkumar Ramagopalan RSS

    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.

        • Re: Bringing value from table to table
          Ramkumar Ramagopalan

          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;