Help with a SUM calculation -- data type conversion error
Posted on 2012-03-23
I am writing a query in SQL to summarize the total number of members that are compliant ("yes" are screened) in each region.
My problem is everytime I try to calculate the SUM, I get an "error stack overflow" message or datatype conversion error (e.g. Error converting data type varchar to float) -- have tried float and bigint, which seemed to make sense but I feel like I'm missing something simple...
Any help is much appreciated!
SELECT * FROM #COMP_YES
SELECT REGION, COUNT(*) AS TOTAL_COMPLIANT
--SUM(cast(REGION as FLOAT)) as TotalExp
--Sum(CAST(REGION AS BIGINT) / 100) AS GRAND_TOT
GROUP BY REGION
ORDER BY COUNT(*) DESC