在DB2下有一个student表里面有个CODE的varchar字段,现在要用SQL语句将里面的值转换成INT再相加得到这个字段的总数,请问应该怎么样写?
------解决方案--------------------------------------------------------
select sum(cast(code as integer)) from student
------解决方案--------------------------------------------------------
同上,CAST 后即可