I have a query where i calculate the sum of column value but that column data type is varchar,so how should i add the sum function to that varchar column
Operand data type varchar is invalid for sum operator.
select
Sum(CASE WHEN sn.StateName LIKE 'newyork%'
OR sn.StateName LIKE 'London%'
THEN 'TotalStateCount'
ELSE StateName
END) as LastState
from stateCapital
here am getting the error like
operand datatype varchar is invalied for Sum operator
can you give me the right answer to resolve this problem
- Edited by Ychinnari 21 hours 50 minutes ago