Teradata-年度等价
我很难找到与Teradata相当的东西(Excel)。我弄乱了以下内容,但希望我希望它显示一年的一部分。因此,我不想看到37.033。如果可能的话,它可以考虑LEAP年的时间,所以不想将其除以365。任何帮助将不胜感激!
SELECT (CURRENT_DATE - CAST('1985-05-01' AS DATE)) YEAR
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有直接功能来获取所需的输出。
Excel YearFrac方法使用不同的逻辑来基于可选参数基础来计算输出。
将基本参数视为0或省略,您可以使用以下查询在Teradata中实现它。
具有0或省略的基础参数使用30/360格式来计算差异。
您可以在下面的链接中找到有关年度FRAC逻辑的更多详细信息。
There is no direct function to get the desired output.
Excel YEARFRAC method uses different logic to calculate the output based on the optional parameter basis.
Considering the basis parameter as 0 or omitted, you can achieve it in Teradata using below query.
The basis parameter with 0 or omitted uses a 30/360 format to calculate the difference.
You can find more details about the YEARFRAC logic in below link.
https://support.microsoft.com/en-us/office/yearfrac-function-3844141e-c76d-4143-82b6-208454ddc6a8