【发布时间】:2020-01-24 00:40:57
【问题描述】:
我正在尝试将变量传递给 over 子句。
最初,我将其硬编码为 over (partition by deviceid order by readdate rows between current row and 2 following)
有没有办法做类似的事情
over (partition by deviceid order by readdate rows between current row and continuousexcessivehours following)
或类似的东西
over (partition by deviceid order by readdate rows between current row and ISNULL(continuousexcessivehours, 2) following)
我得到的错误:错误:Amazon Invalid operation:在“continuousexcessivehours”或附近出现语法错误
感谢您的帮助。
【问题讨论】:
-
这可能取决于数据库。用您正在使用的数据库标记您的问题。而且,当你尝试这个时会发生什么?
-
@GordonLinoff 添加了我遇到的数据库。它仅在我尝试传入变量时发生。如果我通过 2,它工作正常。几乎就像它必须是一个静态数字一样?
标签: sql amazon-redshift window-functions