TERADATA-最后三个工作日交易(这是周末和公共假期)
有一个交易表Tran_details具有交易日期,并且有校准表的calender_days在所有日期是否是营业日都在所有日期上都有标志。我有数百个范围的成员和交易。 Account_no ABC Trandate 14/06/2022(星期二)。现在,我希望该帐户上三个工作日的所有交易,如果13/06/22是公共假期,而11/06/22和12/06.22是一个周末,则是从09/06/2022到14/06/的交易2022意味着3个工作日-09/06、10/06和14/06。我想要可以计算出每种情况下要回去多少天的逻辑,直到考虑公共假期和周末的3个工作日子。
There is a transaction table tran_details that has a transaction date and there is calender table calender_days that has flag against all dates if a particular day is a business day or not. I have few hundreds scoped members and transactions eg. Account_No abc TranDate 14/06/2022 (Tuesday). Now I want all transaction on that account for last three business days and if 13/06/22 was a public holiday and 11/06/22 and 12/06.22 was a weekend, transactions from 09/06/2022 to 14/06/2022 which would mean 3 business days - 09/06, 10/06 and 14/06. I want logic that can calculate how many days to go back in every case to reach up till 3 business days considering public holidays and weekends.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您的日历中得出一个工作日,请参见表并加入它。
然后应用
Derive a business day number from your calendar, see https://stackoverflow.com/a/43040273/2527905 in a Derived Table and join to it.
And then apply a