How to get average in sqlserver select query, column type is nvarchar. In my reviews table rating column is nvarchar. but I inserted integer values. Now I want average of total rating. SELECT AVG(Rating) AS rating FROM CompanyReviews;
numeric
nvarchar
varchar
SELECT AVG(convert(int,Rating)) AS rating FROM CompanyReviews;
SELECT AVG(cast(Rating as int)) AS rating FROM CompanyReviews;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)