--> 测试数据: [ta] if object_id('[ta]') is not null drop table [ta] go create table [ta] ([col1] numeric(3,2)) insert into [ta] select 3.20 union all select 0.20 union all select 4.50select sum(1.0*(floor(col1)*60+(col1-floor(col1))*100)/60) from ta8.499999
3.20
0.10
4.20总共的小时 numeric(sum(列1)
以下面形式存储表中:
列A
3.20
0.20
4.50
如果合计的话应该是
3.20+0.30+4.50=8.67小时
但是用:
select sum(convert(numeric,列A)) from Table_1
得到是8小时
是不是存储的形式有问题
if object_id('[ta]') is not null drop table [ta]
go
create table [ta] ([col1] numeric(3,2))
insert into [ta]
select 3.20 union all
select 0.20 union all
select 4.50select sum(1.0*(floor(col1)*60+(col1-floor(col1))*100)/60) from ta8.499999