0
在SQL Server:MySQL的TIMEDIFF()函數返回0.0000
declare @totalUsageInSeconds decimal(15,6)
SELECT @totalUsageInSeconds = @totalUsageInSeconds + DATEDIFF(SECOND, @resourceStartTime, @resourceEndTime)
上面的查詢給出秒
但在MySQL中,不同的是秒爲單位爲0.0000正確datedifference:(請參考下圖)
declare _totalUsageInSeconds decimal(15,6);
SELECT @totalUsageInSeconds = @totalUsageInSeconds + TIME_TO_SEC(TIMEDIFF(_resourceStartTime, _resourceEndTime));
我可以知道原因以及如何解決問題嗎?