分类: Db2 |
一,在DB2数据库中
具体使用为:
select
sum(decimal(conitem2,10,2)) as aa ,comid from UBL_PROCONTENT
where proid=21967 group
by comid
使用前提:1,varchar类型的字段中必须存的为数字,
但是这些方法在hibernate中都不好使
二,另外查询出另一种方法,但在DB2中不好使,先记下来,以后试试是否是在其它数据库中的方法
select sum(convert(int,维修费))
from table 或
select sum(cast(维修费
as int)) from
table
或
select sum( case
isnumeric(维修费) when
1 then
sum(cast(维修费 as int))
else 0 end
)