SQL Server time processing self-connect

Source: Internet
Author: User
--Delayed orders
Select
T1. OrderId order1, T1. Verifystatusid id1,t1. Verifydate ' time 1 ',
T2. OrderId Order2, T2. Verifystatusid Id2,t2. Verifydate ' Time 2 ',
T1. Verifystatus ' State 1 ',
T2. Verifystatus ' State 2 ',
DateDiff (n, T2. Verifydate,t1. verifydate) ' Delay '
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)--Growing up in one day
and
(
(T2. verifystatus=3024 and T1. verifystatus=3013) or--Trial time
(T2. verifystatus=3013 and T1. verifystatus=3018) or--of Final appeal
(T2. verifystatus=3018 and T1. VERIFYSTATUS=1008) or--Comprehensive Assessment
(T2. verifystatus=1019 and T1. verifystatus=1010)--time of reconsideration
)

SQL Server time processing self-connect

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.