这是我存储过程中的一行。我的表场工作时间是存储分钟。如何将它分割成60来存储。
(select
SUM(ISNULL(hoursworked,0))
from
UserTime
where
userid = @employeeid
and convert(varchar(100),checkin,106) = convert(varchar(100),@Startdate,106)
and loginstatus= 'Out')
hoursworked as int我如何实现这一点?
SUM(ISNULL(hoursworked/60,0))发布于 2014-04-25 18:41:31
你可能得到的是0。您应该先做sum():
coalesce(sum(hoursworked)/60, 0)问题是Server进行整数除法,因此任何小于60 (且大于或等于0)的值都将导致0。你可能真的想:
coalesce(sum(hoursworked)/60.0, 0)https://stackoverflow.com/questions/23300369
复制相似问题