TERADATA-最后三个工作日交易(这是周末和公共假期)

发布于 2025-02-08 00:47:11 字数 287 浏览 2 评论 0原文

有一个交易表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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初见 2025-02-15 00:47:11

从您的日历中得出一个工作日,请参见表并加入它。

然后应用

QUALIFY
   TranDate between max(businessday#) over (partition by Account_No) -2
                and max(businessday#) over (partition by Account_No)

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

QUALIFY
   TranDate between max(businessday#) over (partition by Account_No) -2
                and max(businessday#) over (partition by Account_No)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文