笨小孩做开发

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
 --延时的订单
select
t1.OrderId order1, t1.VerifyStatusId id1,t1.VerifyDate '时间1',
t2.OrderId order2, t2.VerifyStatusId id2,t2.VerifyDate '时间2',
t1.VerifyStatus '状态1',
t2.VerifyStatus '状态2',
datediff(n, t2.VerifyDate,t1.VerifyDate) '延时'
from T_VerifySituation t1, T_VerifySituation t2
where 1 =1 
and (t1.VerifyStatusId>t2.VerifyStatusId)
and (t1.OrderId=t2.OrderId)
and (datediff(d, t2.VerifyDate,t1.VerifyDate)>1)--延时时长大于一天
and 
(
(t2.VerifyStatus=3024 and t1.VerifyStatus=3013)or--初审用时
(t2.VerifyStatus=3013 and t1.VerifyStatus=3018)or--终审用时
(t2.VerifyStatus=3018 and t1.VerifyStatus=1008)or--综评用时
(t2.VerifyStatus=1019 and t1.VerifyStatus=1010)  --复议用时
)
posted on 2015-12-11 17:03  笨小孩做开发  阅读(314)  评论(0编辑  收藏  举报