1:
select ByeTime,case when len(ByeTime)>0 then str(DATEDIFF(day,ComeInTime,ByeTime)) else DATEDIFF(day,ComeInTime,getdate()) end as test
from myUser where DelFlag='0' and UserID='cq'
2:
select ByeTime,case when len(ByeTime)>0 then str(DATEDIFF(day,ComeInTime,ByeTime))+'(已离职)' end as test
from myUser where DelFlag='0' and UserID='cq'
3:
select ByeTime,case when len(ByeTime)>0 then str(DATEDIFF(day,ComeInTime,ByeTime))+'(已离职)'
else str(DATEDIFF(day,ComeInTime,getdate())) end as test
from myUser where DelFlag='0' and UserID='cq'