amazon-web-servicesamazon-athena

AWS Athena SQL - Multiplying the constant number to existing data


I am trying to multiply the existing value with some constant value o.1876. the output of the data is looks like

sales_agg

i just need to mutiply the constant values to existing data and bring to a another column in sql query. tried with Cast Int but no luck. i can ignore the non numeric data in the list and multiply only with proper numeric data.


Solution

  • Think of the values in a SELECT as being a formula. You can therefore use:

    select
      sales_agg * .1876,
      other_column
    from table_name