简体   繁体   English

SQL-DATEDIFF计算天数

[英]SQL - DATEDIFF to calculate days

Need some help here.在这里需要一些帮助。 I have this syntax which I think is wrong - needs a minor fix我有这样的语法,我认为这是错误的-需要小幅修复

DATEDIFF(DAY, GETDATE(), DATEADD(DAY, 3, ESI.EventStatusDate)) AS BackloggedDays 

What I'm actually trying to say is whatever the event status date is (add 3 days, as a grace period) compare that to the current date (get date) and tell me how days its behind (backlogged).我实际上要说的是事件状态日期是什么(作为宽限期增加3天),将其与当前日期(获取日期)进行比较,并告诉我它的滞后天数(积压)。 If there is no back log set it at 0 days如果没有后备日志,则将其设置为0天

Need some help here.在这里需要一些帮助。 I have this syntax which I think is wrong - needs a minor fix我有这样的语法,我认为这是错误的-需要小幅修复

DATEDIFF(DAY, GETDATE(), DATEADD(DAY, 3, ESI.EventStatusDate)) AS BackloggedDays 

What I'm actually trying to say is whatever the event status date is (add 3 days, as a grace period) compare that to the current date (get date) and tell me how days its behind (backlogged).我实际上要说的是事件状态日期是什么(作为宽限期增加3天),将其与当前日期(获取日期)进行比较,并告诉我它的滞后天数(积压)。 If there is no back log set it at 0 days如果没有后备日志,则将其设置为0天

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM