Teradata 相当于 Oracle 的超前和滞后功能
我一直在努力寻找 Oracle 超前和滞后函数的等效函数。
甲骨文领导看起来像
LEAD(col1.date,1,ADD_MONTHS(col1.DATE,12))
OVER(Partition By tab.a,tab.b,tab.c Order By tab.a)-1 END_DATE
LAG(col1.DATE + 7,1,col1.DATE-1)
OVER(partition by tab.a,tab.b Order By tab.b) LAG_DATE
任何更好的主意
I have been working ot see the equivalent function for Oracle lead and lag function.
The oracle lead would look like
LEAD(col1.date,1,ADD_MONTHS(col1.DATE,12))
OVER(Partition By tab.a,tab.b,tab.c Order By tab.a)-1 END_DATE
LAG(col1.DATE + 7,1,col1.DATE-1)
OVER(partition by tab.a,tab.b Order By tab.b) LAG_DATE
Any better idea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信你可以以下面的SQL为基础,修改它来满足你的需求:
前后没有记录时返回NULL,必要时可以用COALESCE解决。
编辑 Teradata 16.00 中引入了 LAG/LEAD 功能。
I believe you can take the following SQL as a basis and modify it to meet your needs:
NULL is returned when there is no record before or after and can be addressed with a COALESCE as necessary.
EDIT In Teradata 16.00 LAG/LEAD functions were introduced.