Sql查询将分钟显示为小时

时间:2014-02-04 06:19:10

标签: sql sql-server

我有sql查询,返回没有分钟,查询是

select 
 PSProjectId,CodePattern,NCR,sum(totaltime) as totaltime --totaltime is in minutes
  from ct2
group by PSProjectId,CodePattern,NCR

,输出

PSProjectId CodePattern NCR totaltime
0000108676  001         blank   NULL
0000109530  520297      blank   24
0000109530  520297S     blank   12
0000109530  520297SREW  blank   9
0000131756  3UA1PSREW   blank   NULL

但我希望以小时显示总时间

例如:24应该是.4,12应该显示为.2等

1 个答案:

答案 0 :(得分:1)

试试这个

select 
 PSProjectId,CodePattern,NCR,sum(totaltime)/60.0 as totaltime --totaltime is in minutes
  from ct2
group by PSProjectId,CodePattern,NCR