[英]Is there a way to reuse a window in teradata?
I would like to reuse the same window definition multiple times within a single query. 我想在一个查询中多次重用相同的窗口定义。
Postgres does it this way: Postgres这样做:
SELECT sum(salary) OVER w, avg(salary) OVER w
FROM empsalary
WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);
Does teradata have an equivalent function to do this? teradata是否具有等效的功能?
there is no equivalent of window function in TD, you have to write window every time 在TD中没有等效的窗口功能,每次都必须编写窗口
SELECT sum(salary) OVER (PARTITION BY depname ORDER BY salary DESC), avg(salary) OVER (PARTITION BY depname ORDER BY salary DESC)
FROM empsalary;
Some documents about window functions: 有关窗口功能的一些文档:
http://www.info.teradata.com/HTMLPubs/DB_TTU_14_00/index.html#page/SQL_Reference/B035_1145_111A/Ordered_Analytical_Functions.083.013.html http://www.info.teradata.com/HTMLPubs/DB_TTU_14_00/index.html#page/SQL_Reference/B035_1145_111A/Ordered_Analytical_Functions.083.013.html
http://www.info.teradata.com/HTMLPubs/DB_TTU_14_00/index.html#page/SQL_Reference/B035_1145_111A/Ordered_Analytical_Functions.083.012.html#ww1271958 http://www.info.teradata.com/HTMLPubs/DB_TTU_14_00/index.html#page/SQL_Reference/B035_1145_111A/Ordered_Analytical_Functions.083.012.html#ww1271958
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.