I have the following sql query code and I can not get to execute the desired output.
SELECT Deal_type, Price_type, cast(sum(Deal_type)/count(Deal_type)*1.0 as decimal(12,2)) as results FROM [dbo].[all] WHERE Deal_type in ('RMBS','abs', 'cmbs', 'clo', 'cdo') GROUP BY Deal_type,Price_type order by Deal_type
I am trying to display the percentage values in decimal and currently its displaying the error message -
Operand data type nvarchar is invalid for sum operator.
Any help with the above query would be very much appreciated.