如何在SQL中使用合并转换浮动

时间:2016-08-11 13:58:25

标签: sql-server

我有以下查询

MERGE Time_Tracker AS target 
USING 
  (SELECT
    USERID,
    SUM(DATEDIFF(MINUTE, '19000101', TotalBreakTime)) / 60 AS ColumnWithBreaksCount
  FROM BreaksTable
  WHERE CONVERT(date, StartTime) = CONVERT(date, GETDATE())
  GROUP BY USERID) AS source 
ON target.USERID = source.USERID 
WHEN MATCHED THEN UPDATE 
  SET BREAKS = source.ColumnWithBreaksCount;

此处我得到的输出在我的休息栏中为0,但时差为10秒,当我将DATEDIFF(minute, '19000101', TotalBreakTime)/60更改为DATEDIFF(second, '19000101', TotalBreakTime)时,它显示我我10中的Breaks column。在这里,我想显示两分钟后跟秒的时差(如0.10),我的中断列为float类型。

请让我知道我该怎么做。

以下是我的结果表

enter image description here

由于

0 个答案:

没有答案