I have two columns in a SQL table and I need a third column with the sum of the other two.
It’s possible to add a calculated column?
SELECT WRAP_DURATION, IS_SERV_TYP_FLAG, FROM RVM_DM.FACT_INTERACTION_SEGMENT
Advertisement
Answer
Yes it is possible. I did this in the following query, of course, if the columns are numeric
SELECT Col1,Col2,SUM(Col1 + Col2) AS Column3 FROM yourTable GROUP BY Col1,Col2
If you want to combine two columns, use the following query
SELECT Col1,Col2,CONCAT(Col1,' ', Col2) AS Column3, FROM yourTable