Subtract two dates in SQL and get days of the result

后端 未结 6 1739
你的背包
你的背包 2021-01-01 09:11
Select I.Fee
From Item I
WHERE GETDATE() - I.DateCreated < 365 days

How can I subtract two days? Result should be days. Ex: 365 days. 500 days..

6条回答
  •  一生所求
    2021-01-01 09:38

    How about

    Select I.Fee
    From Item I
    WHERE  (days(GETDATE()) - days(I.DateCreated) < 365)
    

提交回复
热议问题