How to find the number of days between two dates

后端 未结 9 576
独厮守ぢ
独厮守ぢ 2021-01-04 06:43

I have a basic query:

SELECT dtCreated
    , bActive
    , dtLastPaymentAttempt
    , dtLastUpdated
    , dtLastVisit
FROM Customers
WHERE (bActive = \'true\         


        
9条回答
  •  生来不讨喜
    2021-01-04 07:22

    Get No of Days between two days

    DECLARE @date1 DATE='2015-01-01',
     @date2 DATE='2019-01-01',
     @Total int=null
    
    SET @Total=(SELECT DATEDIFF(DAY, @date1, @date2))
    PRINT @Total
    

提交回复
热议问题