在 SQL 中仅向 DateAdd 添加特定日期?
我正在使用一份库存报告,该报告计算特定零件的平均每周消耗量,然后将其除以我们现有的数量,以向我们显示“现有周数”的数字。因此,如果我们的平均每周消费量为 496,并且我们有 1500 件可用,则现有周数应为 3.02。
我想做的就是获取该数字并准确计算出我们将在哪一天用完相关零件。因此,从现在开始,我们将在 3.02 周内用完示例部分。我的问题是我必须排除周五至周日,因此每个工作周只有四天。
我查看了 DATEADD() 函数,这似乎是我需要使用的函数,但我只是不确定如何从中排除星期五。我为此使用 SQL 2005。
非常感谢!
I've got an inventory report I'm working with which calculates our average weekly consumption of a particular part and then divides it by what we have on hand to show us a numerical "weeks on hand". So if we have an average weekly consumption of 496 and we have 1500 pieces available, the weeks on hand should be 3.02.
What I'm trying to do is take that number and calculate exactly which day we'll run out of the part in question. So we'd run out of the example part in 3.02 weeks from now. My issue is that I have to exclude Fridays - Sundays, so each work week is only four days.
I've looked at the DATEADD() function, and this seems to be what I need to use, but I'm just not sure how to exclude the Fridays from it. I'm using SQL 2005 for this.
Many thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)