select requestid,userid,workflowid,receivedate,receivetime,operatedate,operatetime,
cast(day as varchar)+'天'+cast((hour-day*24) as varchar)+'小时'+
cast((minute-hour*60) as varchar)+'分'+
cast((second-minute*60) as varchar)+'秒' result
from(
select requestid,userid,workflowid,receivedate,receivetime,operatedate,operatetime,
datediff(d, CONVERT(datetime,receivedate+' '+receivetime,20),
CONVERT(datetime,operatedate+' '+operatetime,20)) day,
datediff(hh, CONVERT(datetime,receivedate+' '+receivetime,20),
CONVERT(datetime,operatedate+' '+operatetime,20)) hour,
datediff(n, CONVERT(datetime,receivedate+' '+receivetime,20),
CONVERT(datetime,operatedate+' '+operatetime,20)) minute,
datediff(s, CONVERT(datetime,receivedate+' '+receivetime,20),
CONVERT(datetime,operatedate+' '+operatetime,20)) second
from workflow_currentoperator
where workflowid=297 and requestid=110215
) t
order by receivedate,receivetime
温馨提示:内容为网友见解,仅供参考