TB1
应该返回时间 到达工厂时间 状态
2011-9-17 20:25
2011-9-17 20:25
2011-9-17 20:25
2011-9-20 20:15
2011-9-20 20:15
2011-9-20 20:15
求一更新语句-更新状态字段
判断到达工厂时间是否为空,如果不为空,用到达工厂时间-应该返回时间>0为迟到,否则为不迟到,如果为空,应该返回时间-当天日期,得出剩余返天数
应该返回时间 到达工厂时间 状态
2011-9-17 20:25
2011-9-17 20:25
2011-9-17 20:25
2011-9-20 20:15
2011-9-20 20:15
2011-9-20 20:15
求一更新语句-更新状态字段
判断到达工厂时间是否为空,如果不为空,用到达工厂时间-应该返回时间>0为迟到,否则为不迟到,如果为空,应该返回时间-当天日期,得出剩余返天数
update tb1 set 状态=(case
when 到达工厂时间 is not null and 到达工厂时间>应该返回时间 then '迟到'
when 到达工厂时间 is not null and 到达工厂时间<=应该返回时间 then '不迟到'
else ltrim(datediff(d,到达工厂时间,getdate()))+'天'
end)
when colB is null then ltrim(datediff(dd,getdate(),colA)) end
--蹭点分