秒化分,计算求和问题
有一个时间字段以秒为单位feevalue,现在想把他化成分,然后求和~~~~条件是feevalue在60秒一下都算一分钟,大于等于60秒按60秒一分计算,该怎么写这个SQL语句,帮忙帮忙`11谢谢了表名fee
select sum(field/60) from tablename
create table #tbl1
(
feevalue int,
minute int
)
create table #tbl2
(
feevalue int,
minute money
)
insert into #tbl1
select feevalue, feevalue / 60 from fee
insert into #tbl2
select feevalue, feevalue / 60 from fee
update #tbl1 set minute = a.minute + 1 from #tbl1 join #tbl2 on a.feevalue =b.feevalue and a.minute - b.minute <> 0
select sum(minute) from #tbl1