如何查找每个值的日期之间的总和
表 1
Period datefrom dateto code id
01/2012 18/12/2011 28/12/2011 A Emp1
01/2012 11/01/2012 14/01/2012 B Emp1
02/2012 20/12/2011 25/12/2011 A Emp2
02/2012 01/02/2012 08/01/2012 B Emp2 'from and to date is greater than current date.
.....
我想通过系统日期验证获取 datefrom 和 dateto 之间的总和
预期输出
ID PERIOD A B TOTAL
Emp1 01/2012 11 4 15
Emp2 02/2012 6 0 6
'B 为 0,因为起始日期和截止日期大于当前日期。
如何查询此计算..?
任何建议....
Table1
Period datefrom dateto code id
01/2012 18/12/2011 28/12/2011 A Emp1
01/2012 11/01/2012 14/01/2012 B Emp1
02/2012 20/12/2011 25/12/2011 A Emp2
02/2012 01/02/2012 08/01/2012 B Emp2 'from and to date is greater than current date.
.....
i want to take total of value between datefrom and dateto with system date validation
Expected Output
ID PERIOD A B TOTAL
Emp1 01/2012 11 4 15
Emp2 02/2012 6 0 6
'B is 0 because from and to date is greater than current date.
How to make a query for this calcuatlion..?
Any suggestions....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加到日期差异的加一是为了考虑部分天数。
The plus one added to the date diff is to account for part days.