Adding new Column containing values based on condition

#1

Hi ,

I want to add a new column with values populated based on values from existing column. How can I include the condition. Looking forward for your suggestion.

Regards,
Sajjan

#2

Hi,
I know that we can add a column but I am struggling to find if we can add values to the new column based on values from existing column. Hoping to get a solution.

Regards,
Sajjan.

#3

Hello @sajjan.jindal,

What specifically are trying to accomplish? You can create computed columns for a number of cases. For example, below we are multiplying 2 values in a row and placing the result in a new column:

SELECT name, id, sales_per_quarter * average_sale AS average_sales_per_quarter 
FROM sales_table